Oliver
Oliver

Reputation: 6250

Why doesn't an OSGi Bundle start even when all the Dependencies are resolved?

1) Problem 1:
I have come across this scenario quite a few times, finding transitive dependencies converting them to OSGi format and deploying them in OSGi container is already a pain.

But sometimes even after doing the above, the bundle does not start WHY ?

I double checked the imports, all are satisfied, there are no red marks, but the bundle refuses to go "Active" it always shows "Installed". Why does this happen?

2) Problem 2
Another issue I face is NoClassDefError occurring at runtime even when the class is present in Bundle and the bundle is Active.

An example for this is org.apache.xmlbeans.XmlObject NoClassDefError

If it is missing then it should show it in "red" as missing dependency, but instead it shows all dependencies resolved and bundle is Active? I extracted the contents of the bundle as well to see if it is really there, and found out that it exists then why do these weird errors occur?

Note: My working environment is Adobe CQ5.

enter image description here enter image description here

Upvotes: 2

Views: 4414

Answers (2)

Bertrand Delacretaz
Bertrand Delacretaz

Reputation: 6100

A likely cause for bundles not starting is their activators throwing exceptions. Those should be visible in the logs, and if not I would set a breakpoint in the bundle Activator to see what's happening.

Upvotes: 2

Christian Schneider
Christian Schneider

Reputation: 19606

  1. Simply start the bundle by hand from the shell (I hope CQ has a shell). It should show an exception that helps you.
  2. NoClassDefFound can happen if a bundle accesses a class but does not define an Import-Package statement for the package. If the class is even inside the same bundle then NoClassDefFound means that the bundle does not use the standard classloader. So maybe the bundle is not well prepared for OSGi. You should report such errors as an issue at the community that creates the bundle.

Upvotes: 3

Related Questions