4 Replies Latest reply on Apr 22, 2011 12:13 PM by Bryan Brouckaert

    Incorrect context classloader

    Bryan Brouckaert Newbie

      Hello,

       

      I have a very annoying issue with my context class-loader when I have multiple bundles in my Fuse ESB.

       

      I have several custom bundles (spring), of which:

      [[ 227]] [[Active     ]] [[            ]] [[Started]] [[   80]] Thaler API OSGI Bundle (1.0.0.SNAPSHOT)

      [[ 236]] [[Active     ]] [[            ]] [[Started]] [[   90]] Parameter Web Service (1.0.0.SNAPSHOT)

       

      I have a camel route in bundle 236 that calls a bean that needs the context class-loader (for jpa).  I always got a class not found exception, and when I added the following logging to the bean it was very obvious why:

              ClassLoader oldCL = currentThread().getContextClassLoader();

              log.debug("Old class Loader: " + oldCL);

       

      The result:

      236 - be.mensura.service.param - 1.0.0.SNAPSHOT | Old class Loader: BundleDelegatingClassLoader for [[Thaler API OSGI Bundle (be.mensura.service.thaler)]]

       

      As you can see, bundle 236 got the context class-loader of bundle 227.  I can tell you, these bundles aren't related in any way.

       

      Does anybody have a similar problem?  I have a workaround, but I'm really not happy with it, especially because OSGi is supposed to solve this.  I have a Fuse Support case, but they remain very silent lately.

       

      I was thinking of switching to Karaf as OSGi implementation and see if its helps.  Does anybody has experience with that?  What is your conclusion?  I'm using Fuse ESB 4.3.1.

       

      Kind regards,

      Bryan.