Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
enhancement-engines-0.10.0
-
None
-
Should only affect usages where Stanbol runs within an Embedded OSGI environment and the host application uses XML framewoks
Description
This is caused if the context ClassLoader (Thread#getContextClassLoader) provides Implementations of XML frameworks.
Most Java XML libs prefer to load implementations by using the Thread#getContextClassLoader(). However OSGI has no control over this ClassLoader. Because of that there can be situations where Interfaces are loaded via the Bundle Classloader and the implementations are taken from the context Classloader.
Reported Exception can be very manifold. Typically one would expect ClassCastException mentioning the same class two time. However more often Errors such as ExceptionInInitializerError are reported, as loading of implementations is often done by static members (or static blocks) and the JVM can not report the real exception in such cases.
The only workaround for this problem is resetting the context ClassLoader with the bundle ClassLoader.