1 Reply Latest reply on Jan 8, 2011 7:01 AM by njiang

    JAXB OSGI class loading issues when CXF service  endpoints and proxy client

    marcelcasado

      Hi,

       

      We have JAXB classloading issues in the OSGI using CXF 2.2.10 in Fuse 4.3-02  . It looks like when different JaxbContexts tries to load the same Jaxb class binding that has been load before throws this exception. So we got this exception for every single request :

       

      07:24:02,634 | DEBUG | Timer-16         | Injector                         | .v2.runtime.reflect.opt.Injector  187 |  -  -  | Unable to inject edu/ucar/ral/bindings/org/isotc211/_2005/gmx/UomAlternativeExpression_PropertyType$JaxbAccessorF_show

      java.lang.reflect.InvocationTargetException

           at sun.reflect.GeneratedMethodAccessor64.invoke(Unknown Source)

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_22]

           at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_22]

           at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.inject(Injector.java:181)[76:org.apache.servicemix.bundles.jaxb-impl:2.1.12.1]

       

      .....

       

      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)[:1.6.0_22]

           at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:124)[76:org.apache.servicemix.bundles.jaxb-impl:2.1.12.1]

           at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.(JAXBContextImpl.java:330)[76:org.apache.servicemix.bundles.jaxb-impl:2.1.12.1]

           at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1136)[76:org.apache.servicemix.bundles.jaxb-impl:2.1.12.1]

           at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)[76:org.apache.servicemix.bundles.jaxb-impl:2.1.12.1]

           at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:106)[76:org.apache.servicemix.bundles.jaxb-impl:2.1.12.1]

           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_22]

           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_22]

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_22]

           at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_22]

           at org.apache.cxf.jaxb.JAXBUtils.createBridge(JAXBUtils.java:635)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshalWithBridge(JAXBEncoderDecoder.java:300)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:144)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:198)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:732)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2283)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2156)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2010)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:661)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)[117:org.apache.cxf.bundle:2.2.10.fuse-00-00]

           at $Proxy267.renew(Unknown Source)[163:edu.ucar.ral.bindings.wsn13-wcs112-jaxb:1.3.0.SNAPSHOT]

           at edu.ucar.ral.wxcube.consumer.wcs.PubSubWcsClientImpl.renewSubscription(PubSubWcsClientImpl.java:435)[173:edu.ucar.ral.wx-consumer-wcs:3.5.0.SNAPSHOT]

           at edu.ucar.ral.wxcube.consumer.wcs.SubscriberImpl.renew(SubscriberImpl.java:695)[173:edu.ucar.r

       

      .....

       

      Caused by: java.lang.LinkageError: loader (instance of  org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader): attempted  duplicate class definition for name: "edu/ucar/ral/bindings/org/isotc211/_2005/gmx/UomAlternativeExpression_PropertyType$JaxbAccessorF_show"

           at java.lang.ClassLoader.defineClass1(Native Method)[:1.6.0_22]

           at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)[:1.6.0_22]

           at java.lang.ClassLoader.defineClass(ClassLoader.java:616)[:1.6.0_22]

           at java.lang.ClassLoader.defineClass(ClassLoader.java:466)[:1.6.0_22]

           ... 240 more

       

       

      Complete exception trace can be seen at : http://pastie.org/1438285

       

      Is this a JAXB/OSGI issue or it is related to CXF ?

       

      Thanks,

       

      -Marcel