I am trying to get a handle on using OSGi with Liberty Profile (8.5.5.Next), and am running into problems. It may just be that I'm not understanding some key part of the puzzle, but I don't know for sure what is missing.
I have an OSGi Application Project that contains a number of OSGi Bundle Projects. I am using Apache Commons Lang, so I made it a separate bundle 'apache.commons.lang' (this may not be the best way to handle this, but I was curious how you would use bundles in order to allow different versions of Commons Lang to be used by different apps). Here is my MANIFEST.MF for the bundle:
This bundle is part of the OSGi Application, in its APPLICATION.MF:
During compile time, there are no errors, because the dynamic Plug-in Dependencies are being updated correctly to look for the jar in the right place.
However, when I run my application, I am getting runtime errors trying to find the class 'org.apache.commons.lang3.builder.ToStringBuilder':
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.lang3.builder.ToStringBuilder cannot be found by osgi.identity; osgi.identity="DvdList.JPA";
However, here is the MANIFEST.MF for the DvdList.JPA bundle which is trying to use the class:
To me, everything seems like it is correct. If I remove the Import-Package entry for 'org.apache.commons.lang3.builder' above, then I get compiler errors in the DvdList.JPA project. To me, this tells me that I've got the right entry in the MANIFEST.MF.
So the question is, what else do I need in order for the DvdList.JPA project to be able to find the 'org.apache.commons.lang3.builder.ToStringBuilder' class?