Skip to end of metadata
Go to start of metadata

under construction

OSGi requires that if one bundle needs code in another bundle, the first needs to Import-Package the java package, and the second needs to Export-Package in their MANIFEST.MF files. If some of these are missing, the program will fail somehow. If we are lucky, we get a ClassNotFoundException or NoClassDefFoundException listing the class that is the problem. But sometimes, like in Hiral's case, there is no direct error message. I tried "grep"ing all the "import ..." statements in the .java source files, but this did not find all the required imports.

I found: http://stackoverflow.com/questions/3609982/find-out-dependencies-for-a-any-jar-bundle

One of the tools mentioned was bnd, which we are already using. I tried this yesterday, but it did not find all the required imports. I can try the other tools mentioned in the link. Other options are:

  • We can just live with the problem, if we have a problem, one of the first things we can look for is a missing  Import-Package (or Export-Package).
  • We can just list every possible Export-Package in all of our bundles (this hasn't been the problem) and list every possible Import-Package for all the Export-Packages in all the used bundles.
  • We can switch to Require-Bundle (another MANIFEST.MF header) instead of Import-Package in some cases - but several web sites said the Import-Package is preferable to Require-Bundle.
  • No labels