1

When running my RCP application in Eclipse it works correctly. If I export using the Eclipse Product export wizard and execute the application I get InjectionExceptions.

I've found another question here that is the exact same problem. I've added org.apache.felix.scr to the product configuration but I'm still getting the same issue. I'm assuming another plug-in needs to be added but Add Recommended doesn't add any more.

Start Levels

Start Levels

Exception example

!ENTRY org.eclipse.e4.ui.workbench 4 0 2019-03-05 09:35:24.650
!MESSAGE Unable to create class 'org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon' from bundle '64'
!STACK 0
org.eclipse.e4.core.di.InjectionException: Unable to process "CommandProcessingAddon.broker": no actual value was found for the argument "IEventBroker".
    at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:488)
    at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:479)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:128)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:411)
    at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:347)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:217)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:111)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:77)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:54)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:289)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:153)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:595)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1501)

!ENTRY org.eclipse.e4.ui.workbench 4 0 2019-03-05 09:35:24.650
!MESSAGE Unable to create class 'org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon' from bundle '64'
!STACK 0
org.eclipse.e4.core.di.InjectionException: Unable to process "ContextProcessingAddon.broker": no actual value was found for the argument "IEventBroker".
    at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:488)
    at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:479)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:128)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:411)
    at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:347)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:217)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:111)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:77)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:54)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:289)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:153)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:595)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1501)

What could be causing this?

Michael
  • 3,411
  • 4
  • 25
  • 56
  • What do you have configured for the Start Levels? – greg-449 Mar 05 '19 at 10:54
  • I've updated the question. I'm using the default values when adding them using `Add Recommended`. – Michael Mar 05 '19 at 11:03
  • 1
    Start levels look OK. For e4 you need everything listed in the `org.eclipse.e4.rcp` feature (and the two EMF features it depends on). – greg-449 Mar 05 '19 at 11:12
  • Do you mean I need to add them to the Start Levels or elsewhere? – Michael Mar 05 '19 at 11:15
  • The start levels are OK. I am talking about the plugins required. – greg-449 Mar 05 '19 at 11:17
  • It is far easier to use a feature based build, since you only have to list a small number of features rather than a long list of plugins. [This tutotial](https://www.vogella.com/tutorials/EclipseProductDeployment/article.html) covers features – greg-449 Mar 05 '19 at 11:22
  • Okay I've managed to change over to using features instead of plugins and the application executes. When exporting I get an error. `..\.metadata\.plugins\org.eclipse.pde.core\temp\org.eclipse.pde.container.feature\compile.org.eclipse.pde.container.feature.xml:6: The following error occurred while executing this line:`. My `feature.xml` is copied straight from that tutorial you linked. I've just changed the names around. – Michael Mar 05 '19 at 13:15
  • Do you have any ideas for what might cause this? I've been looking this up for the last few hours and the only things I can find that are similar have been fixed by installing/updating pde. – Michael Mar 05 '19 at 17:01
  • What 'following error'? Doesn't it provide more details? I've no idea what that message is about. – greg-449 Mar 05 '19 at 17:10
  • There isn't anything else. It doesn't give any information about the error apart from the line number in the xmls. Below this is the same but instead of the `feature.xml` it is about the `build.xml`. The errors extend so far that the dialog box can't display them all. I can take a screenshot tomorrow to show you. – Michael Mar 05 '19 at 22:18
  • Look in the .log file in the workspace .metadata directory to see if there is a more of the messages. – greg-449 Mar 06 '19 at 07:27
  • Found it in the logs. `build.xml:43: The following error occurred while executing this line:` is repeated for multiple lines. A `StackOverflowError` occurs. `java.lang.StackOverflowError at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:571) at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:440) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)`. It might be best for me to create a separate question to give more detail. – Michael Mar 06 '19 at 09:54
  • I've created a new question with more detail on this. https://stackoverflow.com/questions/55021437/eclipse-e4-export-build-xml-a-problem-occurred-while-executing-this-line – Michael Mar 06 '19 at 10:59

1 Answers1

2

I managed to fix this by finding the required plug-ins for the feature that @greg-449 mentioned.

First I added org.eclipse.emf.common and org.eclipse.emf.ecore to the Plug-ins and Fragments of the product file.

Next I right clicked and opened each of them to look at their dependencies. I then stepped through each dependency and if I didn't have it in my Required Plug-ins (plugin.xml) I would add it.

Michael
  • 3,411
  • 4
  • 25
  • 56
  • For everyone new to the Eclipse RCP business: Don't confuse the "Start Levels" for the "Debug Configuration" and the "Start Levels" in the "Configuration Tab" for the .product config file. This misunderstanding costs me hours. ;) – Fabian Deitelhoff Mar 21 '22 at 09:26