9

我正在尝试执行我最近从 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 参数来处理注入问题,但我仍然得到相同的结果。

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

问候

4

1 回答 1

23

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

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

更新:对于 Eclipse 2018-09 及以后的版本,org.apache.felix.scr替换org.eclipse.equinox.ds并需要类似的启动级别配置。

于 2018-09-07T07:49:29.113 回答