2 Replies Latest reply on Aug 25, 2011 8:34 PM by Willem Jiang

    Are these class loader issues

    Rogelio Sevilla Novice

      Hello everyone:


      I have been getting a problem when i try to deploy certain bundles into Fuse ESB 4.4. Currently, I'm trying to use the unmarshall method from the Unmarshall class within the Castor plugin version 1.1 (http://www.castor.org/  , there are newer versions but i'm dealing with an old project) ,  my code look like this:



      Unmarshaller.unmarshal(MyProcessingConfig.class, reader);



      I have transformed and deployed the castor 1.1 jar file into a bundle using the bnd tool. The problem is that the previous line is throwing the next  exception on the karaf console:



      java.lang.RuntimeException: Could not instantiate parser org.apache.xerces.parsers.SAXParser: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser not found by castor-1.1

           at org.exolab.castor.util.LocalConfiguration.getParser(LocalConfiguration.java:342)

           at org.exolab.castor.util.LocalConfiguration.getParser(LocalConfiguration.java:273)

           at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:711)

           at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:596)

           at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:817)

           at com.mycompany.MyProcessingConfig.unmarshal(MyProcessingConfig.java:306)



      This is telling me that the SaxParser class doesn't exist,however, when i run the command  packages:exports | grep org.apache.xerces.parsers


      I get the next output:


      146 org.apache.xerces.parsers; version=2.9.1


      Where bundle 146 comes with Fuse and shows as:


      apache ServiceMix Bundles: xercesImpl-2.9.1 (



      Also, just to make sure my castor bundle is importing the right bundles, i executed the command


      osgi:headers 187


      Where 187 is the id of my castor bundle and among the imports i can see the next output




























      The bold lines appear in red in my karaf console,I think this means that those are not found, however, the javax.xml.parsers line appears in white. I have checked the xercesImpl  jar inside the  fuse's endorsed folder and the SaxParser class does exists.



      To be honest, I've found this error a couple of times but a still don't fully understand its nature. Any help with any of these issues would be highly appreciated:



      1.- Any advice on fixing the previous problem??



      2.-Sorry if this one is too basic; how can I tell between a fuse ESB class loader problem and an error that i introduced in my bundle dependencies




      Thanks a lot in advance, this has been my most common problem and any help on finding the right solution would be highly appreciated.