最近在运行Bundle时出现org.osgi.framework.BundleException
!SESSION 2017-09-16 11:31:51.969 ----------------------------------------------- eclipse.buildId=unknown java.version=1.8.0_144 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN Command-line arguments: -dev file:D:/kaifa/eclipse-jee-neon-3-win32-x86_64/history/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -console !ENTRY com.ufgov.app.helloworld 4 0 2017-09-16 11:31:52.334 !MESSAGE FrameworkEvent ERROR !STACK 0 org.osgi.framework.BundleException: Could not resolve module: com.ufgov.app.helloworld [1] Unresolved requirement: Import-Package: javax.servlet; version="2.4.0" at org.eclipse.osgi.container.Module.start(Module.java:444) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1620) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1600) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1571) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1514) at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) !ENTRY org.eclipse.osgi 4 0 2017-09-16 11:31:52.441 !MESSAGE Bundle initial@reference:file:../history/com.ufgov.app.helloworld/ was not resolved.
出现这个问题是只选择了org.eclipse.osgi这个Bundle,除了这个Bundle之外还需要org.eclipse.equinox.console,同时得添加它 的依赖
org.apache.felix.gogo.command
org.apache.felix.gogo.runtime
org.apache.felix.gogo.shell
解决办法:导入Bundle org.eclipse.osgi
![]()
导入org.eclipse.equinox.console Bundle
![]()
导入三个Bundle依赖
![]()
导入之后Run,进入OSGI命令行,输入ss,成功。
osgi> ss "Framework is launched." id State Bundle 0 ACTIVE org.eclipse.osgi_3.11.3.v20170209-1843 1 INSTALLED com.ufgov.app.helloworld_1.0.0 2 ACTIVE org.eclipse.equinox.console_1.1.200.v20150929-1405 3 ACTIVE org.apache.felix.gogo.command_0.10.0.v201209301215 4 ACTIVE org.apache.felix.gogo.runtime_0.10.0.v201209301036 5 ACTIVE org.apache.felix.gogo.shell_0.10.0.v201212101605 osgi> |