Search code examples
javaeclipseexceptionosgibundle

Bundle Exception while running OSGI framework


I'm trying to run my bundle as OSGI framework but i got the following output and i don't know where is the mistake:

!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 OUTPUT:

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

Solution

  • It seems like you are running Eclipse Juno, which comes bundled with OSGi v3.8, which does not uses the Eclipse in built console, but the console is now contained it's own bundle. You need to add that bundle. That is what your OSGi is complaining about. You also need to add some felix bundle to get the new console run.

    In all, at a minimum, you need to select following bundles in your OSGi run configuration:

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


    Or, if you want to use the eclipse built in console, you can enable it by passing following VM arguments:

    -Dosgi.console.enable.builtin=true