1 Reply Latest reply on Oct 27, 2011 7:52 AM by bosschaert

    Bootdelegation and Jaxb

    spandit2

      Hello Folks

       

      I am deploying a OSGI bundle in Jboss AS 7. This Bundles uses JAXB . This bundle alos exposes JAXRS services using CXF DOSGI. So I have also deployed CXF DOSGI bundle .

       

      My problem is when my bundle try to initialize the JAXB context , it throws a class cast exception . Further debugging revealed that JAXBConext is using BundleClassLoader to load the Context factory .

       

      com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to javax.xml.bind.JAXBContext

       

      To avoid this conflict , I am trying to get  my bundle to load JAXB either from Jboss AS7 or from the JDK 1.6 .

       

      I read some article that I can use bootdelegation and specify some packages ao that All these packages will be loaded by parent class loader .

       

      I tried setting bootdelegation for javax.xml.bind.context and for com.sun.* but there is no change in behavior .

       

      I am setting  using  -Dorg.osgi.framework.bootdelegation=sun.*,com.sun.*,javax.*

       

      I have also tried setting org.osgi.framework.system.packages.extra in server configuration , but that doesn't help either.

       

      Has anyone used this before ?

       

      Can someone share thoughts if I am on right track ?

       

      Is there any other way to resolve this issue ?

       

       

      Appreciate any insights.

       

      Sunil