从 Eclipse 运行的 RCP 应用程序运行良好,导出它会抛出 InjectionExceptions



我正在尝试执行我最近从 eclipse Indigo 迁移到 Photon 的 RCP 应用程序。在更改/更新所需的库后,我设法运行了该应用程序,而将产品作为 Eclipse 应用程序(从 Eclipse IDE(启动时没有问题。

但是,当我将产品导出到本机可执行文件并启动它时,我得到几个 InjectionException

!SESSION 2018-09-06 16:48:55.406 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_171
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=es_ES
Framework arguments:  -clearPersistedState
Command-line arguments:  -os win32 -ws win32 -arch x86 -clean -clearPersistedState
!ENTRY org.eclipse.e4.ui.workbench 4 0 2018-09-06 16:48:59.412
!MESSAGE Unable to create class 'org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon' from bundle '52'
!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:489)
at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:480)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:126)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:412)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:345)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:214)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:108)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:74)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:51)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:282)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:617)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
...
!ENTRY org.eclipse.e4.ui.workbench 4 0 2018-09-06 16:48:59.419
!MESSAGE Unable to create class 'org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon' from bundle '52'
!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:489)
at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:480)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:126)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:412)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:345)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:214)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:108)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:74)
at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:51)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:282)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:617)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)

等。

我已经检查了启动配置和产品上的插件列表是否相同(使用"添加所需插件"选择,并在启动配置上使用"验证插件"进行检查(。事实上,从产品页面按下添加所需的插件似乎遗漏了一些启动窗口包含的插件(并且似乎是应用程序在 eclipse 中启动所必需的(,所以我手动将缺少的插件添加到产品中,但仍然没有运气。我已经将最终的插件列表(来自启动配置的插件列表(上传到这个 pastebin 中,看看它是否与它有些关系。从产品自动生成的插件列表几乎相同,但包含的插件少了 7 个(我上面说了,我添加了(。

我是Eclipse Photon和所有这些注入机制的新手,但我很确定我的项目不直接使用它(也许包含的一些新插件间接使用它?

我已经按照另一个答案中的建议使用了 -clean 和 -cleanPersistedState 参数来处理注入问题,但我仍然得到相同的结果。

关于如何解决此问题或如何禁用注入/哪个插件导致调用注入的任何线索?

问候

可能 OSGi 声明性服务插件org.eclipse.equinox.ds没有启动,这会阻止事件代理工厂运行。

如果您使用 xxx.product 文件来配置 RCP,请检查"配置"选项卡的"起始级别"部分。 使用"添加推荐"按钮添加推荐的启动配置,其中包括org.eclipse.equinox.ds

更新:对于 Eclipse 2018-09 及更高版本,org.apache.felix.scr将替换org.eclipse.equinox.ds,并且需要类似的起始级别配置。

最新更新