0 Replies Latest reply on Apr 7, 2011 11:28 AM by futuredan

    Confused about OSGi classloading in ServiceMix 4.3

    futuredan Newbie

      I am having getting a third party library to properly load Xalan.

      I have a bundle that contains a route.  That route contains a reference to a class that is in another bundle comprised of my code.  That bundle references the bundle that I created to wrap the third party library.

      I have traced the code and the third party library is loading Xalan using the following call:


      I further traced the call into the JDK source and the problem occurs on the following line in javax.xml.transform.FactoryFinder:

                      cl = ss.getContextClassLoader();

      This returns a BundleDelegatingClassLoader.

      The issue is that the backingBundle of the BundleDelegatingClassLoader is the bundle in which the route is located.

      I would have expected it to be the bundle that I created to wrap the third party library as that is where the code is actually being called.

      Is there any way for me to change the 'backingBundle'?

      I'd prefer that it be the wrapping bundle, but if it's the bundle containing my class that would be fine.

      Requiring it to be in the route bundle is problematic because every time a new context is created that uses the bundle containing my code, it has to know to import the proper Xalan class.


      Current configuration:

      Fuse - 4.3.0-fuse-03-00

      JDK - 1.6.0_24