gorootde
gorootde

Reputation: 4073

Eclipse OSGi SystemBundleActivator vs BundleActivator

I have an OSGi based (Apache Felix) Eclipse project. It depends on org.eclipse.osgi. As soon as I launch it, the following exception occurs:

Auto-properties install: file:C:\programs\eclipse\plugins \org.eclipse.osgi_3.9.1.v20140110-1610.jar (java.lang.IllegalArgumentException: Start level must be greater than zero.)
java.lang.ClassCastException:   org.eclipse.osgi.framework.internal.core.SystemBundleActivator cannot be cast to   org.osgi.framework.BundleActivator
ERROR: Bundle org.eclipse.osgi [2] Error starting file:C:\programs\eclipse\plugins\org.eclipse.osgi_3.9.1.v20140110-1610.jar   (org.osgi.framework.BundleException: Activator start error in bundle org.eclipse.osgi [2].)
    at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:4342)
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:2147)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2070)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1297)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
at java.lang.Thread.run(Thread.java:744)

So there seems to be a problem inside the org.eclipse.osgi Bundle. As I am not able to change the bundle sourcecode, how to avoid this error?

Upvotes: 0

Views: 821

Answers (1)

Christian Schneider
Christian Schneider

Reputation: 19606

org.eclipse.osgi is an OSGi framework itself. I think you can not run it on the felix framework. So if you really need functionality from org.eclipse.osgi better use it also as OSGi framework. Then it should work better.

Btw. The exact problem you are facing here is that felix already defines the BundleActivator interface and exports is as apackage. org.eclipse.osgi also has this interface embedded and uses its own version. So what the Exception really says is that SystemBundleActivator does not implement the BundleActivator interface from felix.

Upvotes: 2

Related Questions