java - 运行 OSGI 框架时出现 bundle 异常

标签 java eclipse exception osgi bundle

我正在尝试将我的包作为 OSGI 框架运行,但我得到以下输出,但我不知道错误在哪里:

!SESSION 2013-06-25 13:28:45.073 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_21
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -dev file:C:/Users/HP/workspace/.metadata/.plugins/org.eclipse.pde.core/OSGi Framework/dev.properties -os win32 -ws win32 -arch x86 -consoleLog -console

!ENTRY org.eclipse.osgi 4 0 2013-06-25 13:28:51.609
!MESSAGE Could not find bundle: org.eclipse.equinox.console
!STACK 0
org.osgi.framework.BundleException: Could not find bundle: org.eclipse.equinox.console
    at org.eclipse.osgi.framework.internal.core.ConsoleManager.checkForConsoleBundle(ConsoleManager.java:211)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:297)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

> ss 输出:

id  State       Bundle
0   ACTIVE      org.eclipse.osgi_3.8.2.v20130124-134944
2   ACTIVE      org.hamcrest.core_1.1.0.v20090501071000
3   ACTIVE      org.junit_4.10.0.v4_10_0_v20120426-0900
4   ACTIVE      org.apache.felix.gogo.command_0.8.0.v201108120515
5   ACTIVE      org.apache.felix.gogo.runtime_0.8.0.v201108120515
6   ACTIVE      org.eclipse.equinox.console_1.0.0.v20120522-1841
7   ACTIVE      org.apache.felix.gogo.shell_0.8.0.v201110170705
9   ACTIVE      inotify-bundle-core-conf_1.0.0.qualifier

最佳答案

您似乎正在运行 Eclipse Juno,它与 OSGi v3.8 bundle 在一起,它不使用内置控制台中的 Eclipse,但控制台现在包含它自己的 bundle 。您需要添加该 bundle 。这就是您的 OSGi 所提示的。您还需要添加一些 felix 包才能运行新控制台。

总而言之,您至少需要在 OSGi 运行配置中选择以下 bundle :

- org.eclipse.osgi
- org.eclipse.equinox.console
- org.apache.felix.gogo.runtime
- org.apache.felix.gogo.shell


或者,如果您想使用 Eclipse 内置控制台,您可以通过传递以下 VM 参数来启用它:

-Dosgi.console.enable.builtin=true

关于java - 运行 OSGI 框架时出现 bundle 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17296381/

相关文章:

java - 异步任务发生异常

java - Eclipse - 我在窗口首选项中设置了 Java 1.6,但编译器给出了有关 @Override 的错误

java - 使用 lambda 表达式从对象列表中选择对象

java - 如何使用eclipse向jfugue添加依赖?

asp.net-mvc - ASP.NET MVC 和 Ajax 中的异常处理 - [HandleException] 过滤器

C++ - 从 std::exception 继承的错误类的编译错误

java - 如何部署/检索模块化 Maven 项目的模块版本信息?

java - hibernate映射中可以映射多少个表?

android - 单击应用程序时如何打开蓝牙并搜索设备?

python - Python中如何处理带有参数的异常