Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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
need 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

and one of the tools 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