Reputation: 4421
I am currently trying to get started with developing / using OSGi bundles using eclipse. The problem is that the combination eclipse / OSGi is really hard to set up and seems to be very heavy-weight. I created a simple "Hello World" bundle with an Activator. I try to run it as an "OSGi framework", but I get spammed by errors / exceptions. First I get a lot of theses errors:
!ENTRY org.eclipse.update.configurator 4 0 2015-04-18 15:03:31.119
!MESSAGE Could not install bundle plugins/org.eclipse.team.core_3.7.0.v20130514-1224.jar A bundle is already installed with the name "org.eclipse.team.core" and version "3.7.0.v20130514-1224"
I get this for every bundle that ships with eclipse. After that I get the following exception:
org.osgi.framework.BundleException: Exception in org.eclipse.debug.internal.ui.DebugUIPlugin.start() of bundle org.eclipse.debug.ui.
Caused by: java.lang.IllegalStateException: Workbench has not been created yet.
After that I get an exception related to jetty (why?)
org.osgi.framework.BundleException: Exception in org.eclipse.equinox.http.jetty.internal.Activator.start() of bundle org.eclipse.equinox.http.jetty.
Caused by: org.osgi.service.cm.ConfigurationException: default : Permission denied
Caused by: java.net.SocketException: Permission denied
That seems a lot of trouble for getting a program to print "Hello World". Does anyone know how to set up eclipse for plug-in projects?
Upvotes: 2
Views: 741
Reputation: 4421
Well, as it turns out eclipse is a bit sloppy when it comes to creating a new project. In Juno you can either create a "Plug-in Project" or a "Plug-in Development > Plug-in Project". The first is an eclipse plugin, the latter is an ordinary OSGi bundle. This is really unfortunately named.
I created a new OSGi bundle project, a new "OSGi Framework" configuration and added the essentials:
org.apache.felix.gogo.command
org.apache.felix.gogo.runtime
org.apache.felix.gogo.shell
org.eclipse.osgi.console
and my own bundle (com.vogella.osgi.firstbundle
) to the Bundles. Now everything works fine, the thread starts and prints to the console and I can enter commands like ss
/ start
etc.
Upvotes: 2