Details
-
Bug
-
Resolution: Won't Fix
-
Minor
-
None
-
None
-
None
-
None
-
All
-
-
Small
Description
This error occur when a class is loaded with two different class loader in the same JVM.
In our case, this happens when the definition part use a class from a package of the runtime part that is not referenced or imported explicitly in the osgi bundle of the definition part.
(Note that this may occur in other containers as spring for example)
When such a class is used, it will be loaded by the sandbox class loader first as it not present in the parent class loader (not imported by the bundle).
So when the parent class loader try to loaded this class for some reason we will get a java.lang.LinkageError
A solution is to import the package explicitly in the definition bundle with the maven bundle plugin using the `Import-Package` tag
So, if we have such a behavior (definition => runtime) we can't really guess which package is needed or not by the definition to be imported and we will discover the error only at runtime.