osate / osate2-gtse

This plugin enables users to automatically explore the trade space of a system by connecting OSATE to Penn State's Trade Space Visualizer tool.
Other
5 stars 0 forks source link

Injector Error when opening .config file #46

Closed PatZintel closed 4 months ago

PatZintel commented 4 months ago

Reproduction:

  1. Use a new Installation of OSATE 2.
  2. Follow Installation steps for GTSE until Installing ATSV step 4 here
  3. I used the arp4761.config from the example project in this Git.
  4. Get an error when opening the config: Failed to create injector for org.osate.gtse.config.Config (occurred in org.osate.gtse.config.ui.ConfigExecutableExtensionFactory)

Expected: Config file is opened so that it can be saved and the necessary files should be generated.

Exact Stack Trace here: org.eclipse.core.runtime.CoreException: Failed to create injector for org.osate.gtse.config.Config (occurred in org.osate.gtse.config.ui.ConfigExecutableExtensionFactory) at org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory.handleCreationError(AbstractGuiceAwareExecutableExtensionFactory.java:97) at org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory.create(AbstractGuiceAwareExecutableExtensionFactory.java:65) at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:265) at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:63) at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:281) at org.eclipse.ui.internal.registry.EditorDescriptor.createEditor(EditorDescriptor.java:231) at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:321) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPart(CompatibilityPart.java:304) at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPart(CompatibilityEditor.java:61) at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:342) at jdk.internal.reflect.GeneratedMethodAccessor160.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:995) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:960) at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:140) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:403) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:330) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60) at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42) at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:995) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:659) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:763) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:728) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:712) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.lambda$0(PartServiceImpl.java:105) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.lambda$0(UIEventHandler.java:38) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:183) at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133) at org.eclipse.swt.widgets.Display.syncExec(Display.java:4785) at org.eclipse.e4.ui.workbench.swt.DisplayUISynchronize.syncExec(DisplayUISynchronize.java:34) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:133) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424) at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElementGen(ElementContainerImpl.java:170) at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:188) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:660) at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:624) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:790) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:401) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1264) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3210) at org.eclipse.ui.internal.WorkbenchPage.lambda$9(WorkbenchPage.java:3100) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3098) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3068) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3059) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:548) at org.eclipse.ui.ide.IDE.openEditor(IDE.java:508) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:367) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:172) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:288) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:254) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:252) at org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run(OpenAndExpand.java:53) at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:215) at org.eclipse.ui.navigator.CommonNavigatorManager$1.open(CommonNavigatorManager.java:183) at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48) at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:800) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174) at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:797) at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1116) at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:454) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:296) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:331) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596) at org.eclipse.equinox.launcher.Main.run(Main.java:1467) Caused by: java.lang.RuntimeException: Failed to create injector for org.osate.gtse.config.Config at org.osate.gtse.config.ui.internal.ConfigActivator.createInjector(ConfigActivator.java:86) at org.osate.gtse.config.ui.internal.ConfigActivator.getInjector(ConfigActivator.java:70) at org.osate.gtse.config.ui.ConfigExecutableExtensionFactory.getInjector(ConfigExecutableExtensionFactory.java:41) at org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory.create(AbstractGuiceAwareExecutableExtensionFactory.java:54) ... 105 more Caused by: com.google.inject.CreationException: Unable to create injector, see the following errors:

1) [Guice/ErrorInjectingConstructor]: IndexOutOfBoundsException: Index: 3 at Aadl2GrammarAccess.(Aadl2GrammarAccess.java:30768) at Aadl2GrammarAccess.class(Aadl2GrammarAccess.java:30768) at ConfigGrammarAccess.(ConfigGrammarAccess.java:1726) _ for 2nd parameter at ConfigGrammarAccess.class(ConfigGrammarAccess.java:1726) while locating ConfigGrammarAccess at XtextTemplateContextTypeRegistry.(XtextTemplateContextTypeRegistry.java:38) _ for 1st parameter grammarAccess at XtextTemplateContextTypeRegistry.class(XtextTemplateContextTypeRegistry.java:38) while locating XtextTemplateContextTypeRegistry at LanguageRegistrar.contextTypeRegistry(LanguageRegistrar.java:24) _ for field contextTypeRegistry at MethodBasedModule.configure(MethodBasedModule.java:58) _ installed by: Modules$OverrideModule -> ConfigUiModule while locating LanguageRegistrar

Learn more: https://github.com/google/guice/wiki/ERROR_INJECTING_CONSTRUCTOR

1 error

====================== Full classname legend:

Aadl2GrammarAccess: "org.osate.xtext.aadl2.services.Aadl2GrammarAccess" ConfigGrammarAccess: "org.osate.gtse.config.services.ConfigGrammarAccess" ConfigUiModule: "org.osate.gtse.config.ui.ConfigUiModule" LanguageRegistrar: "org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar" MethodBasedModule: "org.eclipse.xtext.service.MethodBasedModule" Modules$OverrideModule: "com.google.inject.util.Modules$OverrideModule" XtextTemplateContextTypeRegistry: "org.eclipse.xtext.ui.editor.templates.XtextTemplateContextTypeRegistry"

End of classname legend:

at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:568)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:190)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:113)
at com.google.inject.Guice.createInjector(Guice.java:87)
at com.google.inject.Guice.createInjector(Guice.java:69)
at com.google.inject.Guice.createInjector(Guice.java:59)
at org.osate.gtse.config.ui.internal.ConfigActivator.createInjector(ConfigActivator.java:82)
... 108 more

Caused by: java.lang.IndexOutOfBoundsException: Index: 3 at java.base/java.util.AbstractSequentialList.get(Unknown Source) at org.osate.xtext.aadl2.services.Aadl2GrammarAccess$MemoryImplementationElements.(Aadl2GrammarAccess.java:13150) at org.osate.xtext.aadl2.services.Aadl2GrammarAccess.(Aadl2GrammarAccess.java:30812) at org.osate.xtext.aadl2.services.Aadl2GrammarAccess$$FastClassByGuice$$102641064.GUICE$TRAMPOLINE() at org.osate.xtext.aadl2.services.Aadl2GrammarAccess$$FastClassByGuice$$102641064.apply() at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82) at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91) at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:296) at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:40) at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:60) at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91) at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:296) at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:60) at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:40) at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:60) at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91) at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:296) at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:60) at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:50) at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:146) at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:124) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91) at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:296) at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:213) at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:186) ... 113 more

lwrage commented 4 months ago

I looked into updating the project for OSATE 2.14, but that would take more time than I have available. I suggest you use OSATE 2.5.x, instead. I did a quick test, and config files can be opened in OSATE 2.5.0. There is a bug fix in OSATE 2.6.0 that breaks instantiation of end to end flows that pass through a replaced sub-component. Note that you must run this project with Java 8 because it uses JAXB, which was removed from later Java distributions.

PatZintel commented 4 months ago

As described, the issue disappeared when downgrading to the older 2.5.0 version.