1 2 Previous Next 19 Replies Latest reply on Jun 26, 2012 10:22 AM by garethahealy

    LinkageError when calling a cxf endpoint

    garethahealy

      My setup is as follows. I have 3 bundles; common, magento and images.

       

      Images does all the work, and uses classes from the other two. When i make a webservices call which throws a soap fault i get the following exception:

       

      Caused by: java.lang.LinkageError: javax/xml/soap/SOAPFault

              at javax.xml.ws.soap.SOAPFaultException.(SOAPFaultException.java:28)

              at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)[175:org.apache.cxf.bundle:2.5.0.fuse-7-061]

              at $Proxy140.catalogProductInfo(Unknown Source)

              at com.boohoo.magento.MagentoProducts.getProductInfo(MagentoProducts.java:325)[990:magento-soap-api:1.0.0.SNAPSHOT]

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

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

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

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

              at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:340)

              at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:237)

              at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:166)

              ... 132 more

       

      Common headers:

      boohoo-esb-common (989)

      -


      Manifest-Version = 1.0

      Bnd-LastModified = 1340024110600

      Tool = Bnd-1.15.0

      Built-By = Gareth.Healy

      Build-Jdk = 1.6.0_29

      Created-By = Apache Maven Bundle Plugin

       

      Bundle-Name = boohoo-esb-common

      Bundle-Description = ESB common library code

      Bundle-SymbolicName = boohoo-esb-common

      Bundle-Version = 1.0.0.SNAPSHOT

      Bundle-ManifestVersion = 2

       

      Import-Package =

              com.mysql.jdbc,

              com.thoughtworks.xstream,

              com.thoughtworks.xstream.io,

              com.thoughtworks.xstream.io.json,

              javax.imageio,

              javax.xml.bind,

              javax.xml.bind.annotation,

              javax.xml.datatype,

              javax.xml.namespace,

              org.apache.activemq.camel.component;version="[5.5,6)",

              org.apache.camel;version="[2.9,3)",

              org.apache.camel.impl;version="[2.9,3)",

              org.apache.commons.codec.binary;version="[1.6,2)",

              org.apache.commons.io;version="[2.3,3)",

              org.osgi.service.blueprint;version="[1.0.0,2.0.0)"

      Export-Package =

              com.boohoo.esb.common;uses:="org.apache.camel.impl,org.apache.camel,com.mysql.jdbc,com.thoughtworks.xstream.io,com.thoughtworks.xstream,com.thoughtworks.xstream.io.json",

              com.boohoo.esb.common.helpers;uses:="javax.imageio,com.boohoo.esb.common,org.apache.commons.io,org.apache.commons.codec.binary,com.boohoo.esb.common.standard.entities",

              com.boohoo.esb.common.orders.entities,

              com.boohoo.esb.common.products.entities;uses:=com.boohoo.esb.common.standard.entities,

              com.boohoo.esb.common.products.helpers;uses:="com.boohoo.esb.common.sage.entities,com.boohoo.esb.common.standard.entities",

              com.boohoo.esb.common.sage.entities,

              com.boohoo.esb.common.standard.entities;uses:="javax.xml.bind.annotation,javax.xml.datatype,javax.xml.bind,javax.xml.namespace"

      Require-Bundle =

              org.apache.cxf.bundle

       

      magento headers:

      magento-soap-api (990)

      -


      Manifest-Version = 1.0

      Bnd-LastModified = 1340024205368

      Tool = Bnd-1.15.0

      Built-By = Gareth.Healy

      Build-Jdk = 1.6.0_29

      Created-By = Apache Maven Bundle Plugin

       

      Bundle-Name = magento-soap-api

      Bundle-Description = Boohoo magento api

      Bundle-SymbolicName = magento-soap-api

      Bundle-Version = 1.0.0.SNAPSHOT

      Bundle-ManifestVersion = 2

       

      Import-Package =

              com.boohoo.esb.common,

              com.boohoo.esb.common.helpers,

              com.boohoo.esb.common.products.helpers,

              com.boohoo.esb.common.sage.entities,

              com.boohoo.esb.common.standard.entities,

              javax.jws,

              javax.jws.soap,

              javax.xml.bind.annotation,

              javax.xml.namespace,

              javax.xml.ws,

              javax.xml.ws.soap,

              org.apache.camel;version="[2.9,3)"

      Export-Package =

              com.boohoo.magento;

                      uses:="com.boohoo.esb.common,

                              magento,

                              org.apache.camel,

                              com.boohoo.esb.common.sage.entities,

                              com.boohoo.esb.common.helpers,

                              com.boohoo.esb.common.products.helpers,

                              com.boohoo.magento.typeconverters,

                              com.boohoo.esb.common.standard.entities,

                              javax.xml.ws.soap",

              com.boohoo.magento.typeconverters;uses:="com.boohoo.esb.common.products.helpers,org.apache.camel,magento,com.boohoo.esb.common.sage.entities,com.boohoo.esb.common.helpers,com.boohoo.esb.common.standard.entities",

              magento;uses:="javax.xml.bind.annotation,javax.jws.soap,javax.jws,javax.xml.ws,javax.xml.namespace"

      Require-Bundle =

              org.apache.cxf.bundle

       

      Images headers:

      boohoo-esb-products-images-into-cms (992)

      -


      Manifest-Version = 1.0

      Bnd-LastModified = 1340024118776

      Tool = Bnd-1.15.0

      Built-By = Gareth.Healy

      Build-Jdk = 1.6.0_29

      Created-By = Apache Maven Bundle Plugin

       

      Bundle-Name = boohoo-esb-products-images-into-cms

      Bundle-Description = Routes for updating product image information in the CMS

      Bundle-SymbolicName = boohoo-esb-products-images-into-cms

      Bundle-Version = 1.0.0.SNAPSHOT

      Bundle-ManifestVersion = 2

       

      Import-Package =

              com.boohoo.esb.common,

              com.boohoo.esb.common.helpers,

              com.boohoo.esb.common.sage.entities,

              com.boohoo.magento,

              magento,

              org.apache.activemq.camel.component;version="[5.5,6)",

              org.apache.camel;version="[2.9,3)",

              org.apache.camel.component.file;version="[2.9,3)",

              org.apache.camel.impl;version="[2.9,3)",

              org.apache.camel.processor.aggregate;version="[2.9,3)",

              org.osgi.service.blueprint;version="[1.0.0,2.0.0)"

      Export-Package =

              com.boohoo.esb.products.images.into.cms.magento.aggregations;

                      uses:="org.apache.camel.component.file,

                              org.apache.camel,

                              com.boohoo.esb.products.images.into.cms.magento.helpers,

                              com.boohoo.esb.common.sage.entities,

                              com.boohoo.esb.products.images.into.cms.magento.holders,

                              org.apache.camel.processor.aggregate,

                              magento",

              com.boohoo.esb.products.images.into.cms.magento.factories;uses:="com.boohoo.esb.common,org.apache.camel",

              com.boohoo.esb.products.images.into.cms.magento.helpers;uses:="org.apache.camel,com.boohoo.esb.products.images.into.cms.magento.holders,com.boohoo.esb.common,com.boohoo.esb.common.sage.entities,com.boohoo.esb.common.helpers",

              com.boohoo.esb.products.images.into.cms.magento.holders;uses:=com.boohoo.esb.common.sage.entities,

              com.boohoo.esb.products.images.into.cms.magento.messagebuidlers;

                      uses:="org.apache.camel.impl,

                              org.apache.camel,

                              com.boohoo.esb.products.images.into.cms.magento.helpers,

                              com.boohoo.esb.common.sage.entities,

                              com.boohoo.esb.products.images.into.cms.magento.holders"

      Require-Bundle =

              org.apache.cxf.bundle

       

      I've spent the last 2 days trying to figure out whats wrong, but havent got anywhere.

        • 1. Re: LinkageError when calling a cxf endpoint
          garethahealy

          I've tweaked the POMs so as that only magento has a requirement on CXF, but i now get a new error:

           

          Caused by: javax.xml.ws.spi.FactoryFinder$ConfigurationError: Provider org.apache.cxf.jaxws.spi.ProviderImpl not found

                  at javax.xml.ws.spi.FactoryFinder$2.run(FactoryFinder.java:130)

                  at javax.xml.ws.spi.FactoryFinder.doPrivileged(FactoryFinder.java:229)

                  at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:124)

                  at javax.xml.ws.spi.FactoryFinder.access$200(FactoryFinder.java:44)

                  at javax.xml.ws.spi.FactoryFinder$3.run(FactoryFinder.java:209)

                  at javax.xml.ws.spi.FactoryFinder.doPrivileged(FactoryFinder.java:229)

                  at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:160)

                  at javax.xml.ws.spi.Provider.provider(Provider.java:43)

                  at javax.xml.ws.Service.(MagentoService.java:39)[1025:magento-soap-api:1.0.0.SNAPSHOT]

                  at com.boohoo.magento.Base.openConnection(Base.java:53)[1025:magento-soap-api:1.0.0.SNAPSHOT]

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

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

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

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

                  at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:340)

                  at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:237)

                  at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:166)

                  ... 78 more

           

          From a bit of googling (here) it suggests creating the following file: /src/main/resources/META-INF/services/javax.xml.ws.spi.Provider

           

          Which i have done, but not to any joy.

          • 2. Re: LinkageError when calling a cxf endpoint
            gertv

            L.S.,

             

             

            We did change the way these specs are being loaded to allow reusing the JRE implementation when nothing else is available, but still allow using the more advanced OSGi-aware implementations to be used as well.  Though I haven't seen this exception before, there may always be a case we're not handling correctly yet.

             

            Do you think you can create a sample project and provide us with some instructions to reproduce the issue, so we can look into this? 

             

            One more question: what platform (OS, JRE, ...) are you using?

             

             

            Regards,

             

            Gert Vanthienen

            • 3. Re: LinkageError when calling a cxf endpoint
              garethahealy

              I found a few people saying (here) that i should do:

               

              Thread.currentThread().setContextClassLoader(Bus.class.getClassLoader());

               

              This stopped the above error, but is now causing another problem, in that unmarshalling now doesnt work:

               

              Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - com.thoughtworks.xstream.mapper.CannotResolveClassException: com.boohoo.esb.products.images.into.cms.magento.holders.ImageFileHolder : com.boohoo.esb.products.images.into.cms.magento.holders.ImageFileHolder not found by org.apache.cxf.bundle

              • 4. Re: LinkageError when calling a cxf endpoint
                ffang

                Hi,

                 

                Did you save the oldClassloader and set the oldClassloader back after you call

                Service.create..?

                 

                Freeman

                • 5. Re: LinkageError when calling a cxf endpoint
                  garethahealy

                  No, i wasnt. But i've changed my code so that it is. But now, i am back to square one as i am getting the linkage error again. I am not sure how to send you a mocked up project as well, because the problem only occurs when a soap fault is thrown when calling the web service, and i currently dont have an external web service i can give you access to...

                   

                  Caused by: java.lang.LinkageError: javax/xml/soap/SOAPFault

                          at javax.xml.ws.soap.SOAPFaultException.(SOAPFaultException.java:28)[:2.0.0.fuse-7-061]

                          at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)[175:org.apache.cxf.bundle:2.5.0.fuse-7-061]

                          at $Proxy112.catalogProductInfo(Unknown Source)

                          at com.boohoo.magento.MagentoProducts.getProductInfo(MagentoProducts.java:346)

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

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

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

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

                          at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:340)

                          at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:237)

                          at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:166)

                  • 6. Re: LinkageError when calling a cxf endpoint
                    garethahealy

                    Scrap that, heres a mocked up project which shows the error.

                    • 7. Re: LinkageError when calling a cxf endpoint
                      njiang

                      Which version of Fuse ESB are you using?

                      Can you double check the bundle you installed if there are more than one bundle exports the package of "javax.xml.soap" ?

                       

                      Willem

                      • 8. Re: LinkageError when calling a cxf endpoint
                        garethahealy

                        I am using: fuse-esb-7.0.0.fuse-061

                         

                        And the only package that does anything SOAPy is the magento one, which has:

                         

                        Import-Package =

                                javax.xml.soap,

                                javax.xml.ws.soap,

                                org.apache.cxf

                        Export-Package =

                                com.boohoo.magento;uses:="org.apache.cxf,javax.xml.soap,javax.xml.ws.soap"

                        Require-Bundle =

                                org.apache.cxf.bundle

                        • 9. Re: LinkageError when calling a cxf endpoint
                          ffang

                          Hi,

                           

                          Could you edit

                          $FUSE_ESB/etc/jre.properties

                           

                          comment out pacakge

                          javax.xml.soap, (you can just add # before this line to comment it out)

                           

                          then remove $FUSE_ESB/data folder and restart fuse esb, to see if it works for you?

                           

                          Or

                          another solution is that you revise the magento bundle OSGi metadata header a little bit, specify version 1.3 for Import-Pacakge javax.xml.soap.

                           

                          Freeman

                           

                           

                          Freeman

                           

                          Edited by: ffang on Jun 21, 2012 8:35 AM

                          • 10. Re: LinkageError when calling a cxf endpoint
                            garethahealy

                            I did as you suggested for soloution 1 (changing the jre file), which didnt work.

                             

                            I also changed the import headers to: javax.xml.soap;version="1.3" which didnt work either...

                             

                            Few bits more of info: v1.6.0_29 and windows 7 pro sp1 (my dev machine)

                             

                            Edited by: garethahealy on Jun 21, 2012 9:36 AM

                            • 11. Re: LinkageError when calling a cxf endpoint
                              ffang

                              Hi,

                               

                              There are two javax.xml.soap in jre.properties, ensure you comment out both, also ensure you remove $FUSE_ESB/data folder after change.

                               

                              If it still doesn't work you do both I mentioned, I'll take a close look at the testcase you appended,  could you elaborate the steps how I can reproduce the exception?

                               

                              Freeman

                              • 12. Re: LinkageError when calling a cxf endpoint
                                garethahealy

                                Yeah, i commented out both soap on lines 123 and 285. And i also deleted everything in the data folder, which caused me to the then re-add the features url and load in my bundles again, which i presume you wanted to happen.

                                 

                                To get my test project to work, all you need to do is change the property "image.location" to where ever you unzip the bundles to, i.e.:

                                 

                                <cm:property value="C:\_Code\WorkspaceTemp\_image\" name="images.location"/>

                                 

                                The above property is in the 'boohoo-esb-products-images-into-cms-fuse' bundle context file.

                                 

                                The '_image' folder contains an image, which will be read in, parsed, sent over active mq and then a SOAPFault will be thrown. I've supplied a features file as well, so you can just do:

                                 

                                features:addurl mvn:com.boohoo/boohoo-esb-features-fuse/1.0-SNAPSHOT/xml/features

                                features:install boohoo-esb-products-into-cms-fuse

                                 

                                Cheers.

                                 

                                Edited by: garethahealy on Jun 21, 2012 10:53 AM

                                • 13. Re: LinkageError when calling a cxf endpoint
                                  ffang

                                  Hi,

                                   

                                  Took a close look at your testcase.

                                   

                                  The testcase actually has nothing to do with cxf inspire me.

                                   

                                  So what you need do is

                                  1. don't change the jre.properties, if you did rollback it first

                                  2. edit magento-soap-api-fuse/pom.xml, add javax.xml.soap;version="[0, 0]", for Import-Package

                                   

                                  then your testcase works for me, I can see output like

                                  15:05:27,839 | INFO  | read_4016/_image | watchImagesFolder                | 138 - org.apache.camel.camel-core - 2.9.0.fuse-7-061 | Found file

                                  15:05:33,406 | INFO  | r[imagesIntoCms] | imagesIntoCms                    | 138 - org.apache.camel.camel-core - 2.9.0.fuse-7-061 | body == {"com.boohoo.esb.products.images.into.cms.magento.holders.ImageFileHolder":{"imageFiles":{"entry":{"string":"azz709256","list":{"com.boohoo.esb.common.sage.entities.Media":{"mode":"A","sku":"azz709256","colour":"black","mediaKey":"medium","fileNameInMagento":"\/a\/z\/azz709256_black_default_m.jpg","fileName":"azz709256_black_default_m.jpg","fileNameWithoutExtension":"azz709256_black_default_m","pathToFile":"\/Users\/ffang\/issues\/thread_4016\/_image\/.camel\/azz709256_black_default_m.jpg","mime":"image\/jpg"}}}}}}

                                  15:05:33,417 | INFO  | r[imagesIntoCms] | imagesIntoCms                    | 138 - org.apache.camel.camel-core - 2.9.0.fuse-7-061 | Json is now an object, WAHOOO!

                                  15:05:33,510 | INFO  | ActiveMQ Task-4  | FailoverTransport                | 118 - org.apache.activemq.activemq-core - 5.5.1.fuse-7-061 | Successfully connected to tcp://127.0.0.1:61616

                                   

                                  in log, I believe that's what you expect.

                                   

                                  Freeman

                                  • 14. Re: LinkageError when calling a cxf endpoint
                                    garethahealy

                                    I changed the POM (see) and un-did the jre changes (deleted data folder as well) but i still get the linkageerror.

                                    1 2 Previous Next