Eclipse插件(RCP)org.osgi.framework.BundleException: Could not resolve module: org.eclipse.aaa.bbb.cccc

萧波峻
2023-12-01

问题

在写文章Eclipse插件(RCP)项目搭建时遇到了异常
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.wst.xml.core

问题发生在启动过程,启动时成功的,但控制台始终报这个错误。

解决

解决方式一

  1. 停止启动的应用
  2. 关闭Eclipse
  3. 删除工作空间中.metadata\.plugins\下所有插件
  4. 重启Eclipse
  5. 重新导入项目
  6. 启动,后这个问题就不存在了

解决方式二

  1. 停止启动的应用
  2. 关闭Eclipse,重新启动,启动时指定新的工作空间
  3. 导入项目

分析

我使用了两个版本的Eclipse,分别是2020-06版和2021-12版。启动时给它们指定了相同的工作空间,并且都用他们尝试建同一个项目。因此猜测在这个工作空间中插件比较混杂,Eclipse加载的插件信息也就有问题了。

总结

Eclipse 工作空间的信息对Eclipse运行时环境影响比较大,如遇到一些莫名问题时,可以采用本文介绍的方式尝试。

附:

具体信息如下:

!SESSION 2022-03-06 10:09:24.940 -----------------------------------------------
eclipse.buildId=unknown
java.version=11.0.11
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN
Framework arguments:  -application com.xzbd.rcp01.application
Command-line arguments:  -application com.xzbd.rcp01.application -data D:\z_eclipse_workspace_rcp/../runtime-rcp01 -dev file:D:/z_eclipse_workspace_rcp/.metadata/.plugins/org.eclipse.pde.core/rcp01/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.wst.xml.core 4 0 2022-03-06 10:09:28.634
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.wst.xml.core [92]
  Unresolved requirement: Require-Bundle: org.apache.xerces; bundle-version="[2.12.1,3.0.0)"; visibility:="reexport"

	at org.eclipse.osgi.container.Module.start(Module.java:463)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.lambda$1(ModuleContainer.java:1834)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1829)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1775)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1739)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1661)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:228)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:339)

!ENTRY org.eclipse.m2e.model.edit 4 0 2022-03-06 10:09:28.639
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.m2e.model.edit [120]
  Unresolved requirement: Require-Bundle: org.eclipse.wst.xml.core; visibility:="reexport"
    -> Bundle-SymbolicName: org.eclipse.wst.xml.core; bundle-version="1.2.400.v202107272335"; singleton:="true"
       org.eclipse.wst.xml.core [92]
         Unresolved requirement: Require-Bundle: org.apache.xerces; bundle-version="[2.12.1,3.0.0)"; visibility:="reexport"

	at org.eclipse.osgi.container.Module.start(Module.java:463)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.lambda$1(ModuleContainer.java:1834)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1829)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1775)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1739)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1661)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:228)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:339)

!ENTRY org.eclipse.m2e.core.ui 4 0 2022-03-06 10:09:28.641
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.m2e.core.ui [130]
  Unresolved requirement: Require-Bundle: org.eclipse.m2e.model.edit; bundle-version="[1.16.0,2.0.0)"; visibility:="reexport"
    -> Bundle-SymbolicName: org.eclipse.m2e.model.edit; bundle-version="1.18.2.20211002-1029"; singleton:="true"
       org.eclipse.m2e.model.edit [120]
         Unresolved requirement: Require-Bundle: org.eclipse.wst.xml.core; visibility:="reexport"
           -> Bundle-SymbolicName: org.eclipse.wst.xml.core; bundle-version="1.2.400.v202107272335"; singleton:="true"
              org.eclipse.wst.xml.core [92]
                Unresolved requirement: Require-Bundle: org.apache.xerces; bundle-version="[2.12.1,3.0.0)"; visibility:="reexport"

	at org.eclipse.osgi.container.Module.start(Module.java:463)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.lambda$1(ModuleContainer.java:1834)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1829)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1775)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1739)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1661)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:228)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:339)

!ENTRY org.eclipse.e4.ui.workbench 4 0 2022-03-06 10:09:30.018
!MESSAGE Unable to retrieve the bundle from the URI: bundleclass://org.eclipse.ui.ide.application/org.eclipse.ui.internal.ide.application.addons.ModelCleanupAddon

 类似资料: