5 Replies Latest reply on Aug 31, 2010 9:17 AM by Franz van Betteraey

    java.lang.LinkageError using camel-cxf in FUSE 4.3

    Franz van Betteraey Newbie

      Hello,

       

      I try to define a camel route from a camel-cxf consumer endpoint to a file. Sending a message to the camel-cxf endpoint results in the error message:

       

      java.lang.LinkageError: loader constraint violation: when resolving overridden method 
      "org.apache.cxf.jaxb.attachment.JAXBAttachmentUnmarshaller.getAttachmentAsDataHandler(Ljava/lang/String;)Ljavax/activation/DataHandler;" 
      the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) of the current class, org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller, and its superclass loader (instance of <bootloader>), 
      have different Class objects for the type javax/activation/DataHandler used in the signature
      

       

      The error can be reproduced by trying to run the 'cxf-camel-nrm' example in a 'fresh' FUSE ESB 4.3 installation:

       

      
      karaf@root> features:install examples-cxf-camel-nmr
      karaf@root> >>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:sayHi xmlns:ns1="
      http://cxfcamel.examples.servicemix.apache.org/"><arg0>Guillaume</arg0></ns1:sayHi></soap:Body></soap:Envelope>
      Exception in thread "pool-nmr.endpoint.HelloWorld-thread-1" java.lang.LinkageError: loader constraint violation: when re
      solving overridden method "org.apache.cxf.jaxb.attachment.JAXBAttachmentUnmarshaller.getAttachmentAsDataHandler(Ljava/la
      ng/String;)Ljavax/activation/DataHandler;" the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultCl
      assLoader) of the current class, org/apache/cxf/jaxb/attachment/JAXBAttachmentUnmarshaller, and its superclass loader (i
      nstance of <bootloader>), have different Class objects for the type javax/activation/DataHandler used in the signature
              at org.apache.cxf.jaxb.JAXBDataBase.getAttachmentUnmarshaller(JAXBDataBase.java:78)
              at org.apache.cxf.jaxb.io.DataReaderImpl.createUnmarshaller(DataReaderImpl.java:92)
              at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:128)
              at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:109)
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
              at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
              at org.apache.servicemix.cxf.transport.nmr.NMRDestination.process(NMRDestination.java:147)
              at org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)
              at org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)
              at org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at java.lang.Thread.run(Thread.java:619)
      

       

      I do not know how to avoid this error and would be thankful for any help.

       

      Regards

        Franz

        • 1. Re: java.lang.LinkageError using camel-cxf in FUSE 4.3
          Claus Ibsen Master

          What OS are you using?

          What JVM are you using?

           

          Does other examples work?

          • 2. Re: java.lang.LinkageError using camel-cxf in FUSE 4.3
            Franz van Betteraey Newbie

            I am on Windows XP with Java 1.6.0_10.

             

            These are my JVM arguments:

             

            -Xms128M
            -Xmx1024M
            -XX:PermSize=64M
            -XX:MaxPermSize=256M
            -verbose:gc
            -Xloggc:karaf.gc.log
            -XX:+PrintGCTimeStamps
            -XX:+PrintGCDetails
            -Dderby.system.home=C:\progs\apache-servicemix-4.3.0-fuse-00-00\bin\..\data\derby
            -Dderby.storage.fileSyncTransactionLog=true
            -Dcom.sun.management.jmxremote
            -Dkaraf.startLocalConsole=true
            -Dkaraf.startRemoteShell=true
            -Djava.endorsed.dirs=C:\Programme\Java\jdk1.6.0_10\jre\lib\endorsed;C:\Programme\Java\jdk1.6.0_10\lib\endorsed;C:\progs\apache-servicemix-4.3.0-fuse-00-00\bin\..\lib\endorsed
            -Djava.ext.dirs=C:\Programme\Java\jdk1.6.0_10\jre\lib\ext;C:\Programme\Java\jdk1.6.0_10\lib\ext;C:\progs\apache-servicemix-4.3.0-fuse-00-00\bin\..\lib\ext
            -Dkaraf.instances=C:\progs\apache-servicemix-4.3.0-fuse-00-00\bin\..\instances
            -Dkaraf.home=C:\progs\apache-servicemix-4.3.0-fuse-00-00\bin\..
            -Dkaraf.base=C:\progs\apache-servicemix-4.3.0-fuse-00-00\bin\..
            -Dkaraf.data=C:\progs\apache-servicemix-4.3.0-fuse-00-00\bin\..\data
            -Djava.util.logging.config.file=C:\progs\apache-servicemix-4.3.0-fuse-00-00\bin\..\etc\java.util.logging.properties 
            

             

            I did not check any other example but will if it helps. Any suggestions which example to test? Are you able to reproduce it?

            • 3. Re: java.lang.LinkageError using camel-cxf in FUSE 4.3
              Franz van Betteraey Newbie

              Important notice:

               

              I thought I get the error in a fresh FUSE ESB installation because I cleaned the 'data' folder - but I just tried to reproduce it in a really fresh (unzipped) FUSE ESB version an it seems to work fine!

               

              I did the following configuration changes:

              (1) use equinox instead of felix (still works fine in fresh installation)

              (2) added some bootFeatures

              (3) added some jre.properties (to get corba packages)

              (4) ???

               

              I will investigate which configuration change causes the error. Until that please do not expend any time.

               

              I will be back for help if needed!

              • 4. Re: java.lang.LinkageError using camel-cxf in FUSE 4.3
                Willem Jiang Master

                It looks like your changes let the OSGi runtime load the Activation instance into the system bundle instead of loading it from the Activation bundle.

                 

                Please check the configures, and make sure you didn't export "javax.activation.*" in the system bundle.

                 

                Willem

                • 5. Re: java.lang.LinkageError using camel-cxf in FUSE 4.3
                  Franz van Betteraey Newbie

                  The javax.activation is commented out by default in 'etc/jre.properties' so I did not expect to find this package.

                   

                  I checked

                   

                  
                  #
                  # working system
                  #
                  karaf@root> packages:exports | grep javax.activation
                  OSGi System Bundle (0): # javax.activation; version="0.0.0"
                  Apache ServiceMix Specs :: ACTIVATION API 1.4 (63): javax.activation; version="1.1.0"
                  

                   

                  #
                  # not working system
                  #
                  karaf@root> packages:exports | grep javax.activation
                  OSGi System Bundle (0): # javax.activation; version="0.0.0"
                  Apache ServiceMix Specs :: ACTIVATION API 1.4 (63): javax.activation; version="1.1.0"
                  

                   

                  Both the same - I do not know how to interpret this.

                   

                  I finally found that I added 'javax.xml.*' to the bootdelegation in config.properties (I can not remeber why because I do not need it).

                   

                  org.osgi.framework.bootdelegation=sun.*,com.sun.*,javax.transaction,javax.transaction.*,javax.xml.*
                  

                   

                  This change causes the problem and let the example fail.

                   

                  Thanks for help.

                    Franz