I'm getting a NoClassDefFoundError
at runtime and I thought the "uses"
directive would avoid this because I thought it created transitivity (correct me if I'm wrong).
Here is my configuration:
Bundle 1
Export-package A
Bundle 2
Export-package B, uses "A"
Import-package A
Bundle 3
Import-package B
Now, the exception happens when Bundle 3 makes a call to a class in B which in turn makes a call to a class in A. Based on the console, i can see that the BundleClassLoader
looks for the class in bundle 3 (in other words, in itself), but not in Bundle 1 where it would find it. If i force BND to import A in Bundle 3 everything works fine, but it looks too labor intensive. i feel like I'm missing something. Shouldn't equinox use the info in the manifests to set the bundle classpath? or in the worst case, shouldn't BND detect the dependency of 3 on 1 and import package A in the manifest of 3?
All my bundles are active
and i have no uses
constraint violations
Bundle 2 must also import A. The uses A says that any bundle that imports my B and also imports A must import the same A as me. Since bundle 2 does not import A, this doesn't work. Also, bundle 3 needs to import A since B uses A. Any importer of B is also a user of A and so must import A.