TelluIoT / ThingML

The ThingML modelling language
https://github.com/TelluIoT/ThingML
Apache License 2.0
101 stars 32 forks source link

Compilers bundle does not load in runtime workbench #171

Closed ffleurey closed 7 years ago

ffleurey commented 7 years ago

I have tested both with windows and linux. Using the latest version of Eclipse (Neon.3), the compiler bundle does not load properly and the following exception accurs when opening the ThingML Compilers menu:

java.lang.NoClassDefFoundError: org/thingml/compilers/registry/ThingMLCompilerRegistry at org.thingml.eclipse.ui.commands.DynamicCompilerMenu.getContributionItems(DynamicCompilerMenu.java:38) at org.eclipse.ui.actions.CompoundContributionItem.getContributionItemsToFill(CompoundContributionItem.java:86) at org.eclipse.ui.actions.CompoundContributionItem.fill(CompoundContributionItem.java:59) at org.eclipse.ui.internal.menus.DynamicMenuContributionItem.fill(DynamicMenuContributionItem.java:147) at org.eclipse.jface.action.MenuManager.doItemFill(MenuManager.java:728) at org.eclipse.jface.action.MenuManager.update(MenuManager.java:810) at org.eclipse.jface.action.MenuManager.handleAboutToShow(MenuManager.java:472) at org.eclipse.jface.action.MenuManager.access$1(MenuManager.java:465) at org.eclipse.jface.action.MenuManager$2.menuShown(MenuManager.java:497) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:256) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1103) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1084) at org.eclipse.swt.widgets.Control.WM_INITMENUPOPUP(Control.java:5160) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4828) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:359) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1656) at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2199) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5110) at org.eclipse.swt.internal.win32.OS.TrackPopupMenu(Native Method) at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:262) at org.eclipse.swt.widgets.Display.runPopups(Display.java:4277) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3818) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) at org.eclipse.equinox.launcher.Main.run(Main.java:1519) at org.eclipse.equinox.launcher.Main.main(Main.java:1492) Caused by: java.lang.ClassNotFoundException: org.thingml.compilers.registry.ThingMLCompilerRegistry cannot be found by thingml.ui_2.0.0.qualifier at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:372) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161) at java.lang.ClassLoader.loadClass(Unknown Source) ... 47 more

For some reason it seemed to work when using neon.2 on windows but I do not understand why the bundle is not found.

When compiling the update site and installing the plugins there are no problems and the compilers load without issues...

ffleurey commented 7 years ago

Correction: The bundle is found when the plugins are installed but it does not really work anymore, I get a strange NoSuchMethodError.... Here is a stack trace:

Compiling with "Plain Java" (Platform: java) Selected input file: BounceApp.thingml (C:\home\checkouts\ThingML-PongTutorial\src\brick_java\BounceApp.thingml) FATAL ERROR: Exeption calling ThingML Compiler: org.thingml.xtext.helpers.ThingHelper.allPropertiesInDepth(Lorg/thingml/xtext/thingML/Thing;)Ljava/util/List;Please contact the ThingML development team (though GitHub's issue tracker) with 1) your input model, and 2) the following stack trace:java.lang.NoSuchMethodError: org.thingml.xtext.helpers.ThingHelper.allPropertiesInDepth(Lorg/thingml/xtext/thingML/Thing;)Ljava/util/List; at org.thingml.compilers.checker.genericRules.PropertyInitialization.check(PropertyInitialization.java:66) at org.thingml.compilers.checker.Checker.do_generic_check(Checker.java:100) at org.thingml.compilers.ThingMLCompiler.loadModel(ThingMLCompiler.java:135) at org.thingml.eclipse.ui.commands.CompileThingFile.execute(CompileThingFile.java:157) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:295) at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:282) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:264) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132) at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:488) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210) at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:353) at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:830) at org.eclipse.ui.menus.CommandContributionItem.access$21(CommandContributionItem.java:816) at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:806) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610) at org.eclipse.equinox.launcher.Main.run(Main.java:1519)

There is something wrong in the packaging of the bundle... I will investigate...

ffleurey commented 7 years ago

The generated update site now works as it should. Plugins can be installed either from the local disk (after a mvn clean install in the language directory) or from the update site. Installing and updating works as it should.

In terms of the runtime workbench, there are no easy solutions. Maybe creating a manifest which points to the eclipse project path instead of the jars.... but that is going to be brittle.