You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Eclipse RCP导出启动报错:Unresolved requirement依赖问题求助

Eclipse RCP应用导出后启动失败:缺少javax.inject依赖

我在Eclipse 4.17中基于Java 1.8开发了一款RCP应用,IDE内运行正常,但导出后启动时抛出Bundle依赖解析错误,堆栈跟踪如下:

!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: feuvert [2]
  Unresolved requirement: Require-Bundle: org.eclipse.ui
    -> Bundle-SymbolicName: org.eclipse.ui; bundle-version="3.118.0.v20200807-0902"; singleton="true"
       org.eclipse.ui [20]
         Unresolved requirement: Require-Bundle: org.eclipse.ui.workbench; bundle-version="[3.120.0,4.0.0)"; visibility="reexport"
           -> Bundle-SymbolicName: org.eclipse.ui.workbench; bundle-version="3.120.0.v20200829-1411"; singleton="true"
              org.eclipse.ui.workbench [21]
                Unresolved requirement: Import-Package: javax.inject; version="1.0.0"

    at org.eclipse.osgi.container.Module.start(Module.java:463)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1845)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1838)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1779)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1743)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1665)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

!ENTRY org.eclipse.ui 4 0 2024-05-21 10:18:24.883
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.ui [20]
  Unresolved requirement: Require-Bundle: org.eclipse.ui.workbench; bundle-version="[3.120.0,4.0.0)"; visibility="reexport"
    -> Bundle-SymbolicName: org.eclipse.ui.workbench; bundle-version="3.120.0.v20200829-1411"; singleton="true"
       org.eclipse.ui.workbench [21]
         Unresolved requirement: Import-Package: javax.inject; version="1.0.0"

    at org.eclipse.osgi.container.Module.start(Module.java:463)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1845)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1838)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1779)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1743)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1665)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

我已检查运行配置的Plugins标签及插件的Contents标签,确认相关bundle已存在;尝试过添加所有所需插件仍未解决问题。


解决方案

  • 确认导出目标平台包含javax.inject:IDE运行时可能自动引入该依赖,但导出时需确保目标平台中存在javax.inject bundle(或提供该包的org.eclipse.sisu.inject),可通过目标平台编辑器验证依赖链。
  • 显式勾选javax.inject到导出配置:在导出向导的Plugins and Fragments页面,搜索javax.inject并选中对应的bundle,确保它被包含在导出包内。
  • 基于有效运行配置导出:如果IDE内的运行配置能正常启动,导出时选择"Use an existing launch configuration",直接复用该配置的依赖集合,避免手动选择遗漏。
  • 清理项目后重新导出:执行Project -> Clean清理项目缓存,再重新执行导出流程,排除旧配置干扰。
  • 检查org.eclipse.ui.workbench的依赖:确认目标平台中org.eclipse.ui.workbench 3.120.0版本所需的javax.inject;version="1.0.0"确实被满足,若目标平台版本不匹配,需调整目标平台至兼容版本。

内容的提问来源于stack exchange,提问作者Alvaro ZG

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 20:05:57