2 Replies Latest reply on May 10, 2012 5:06 AM by paul berry

    External web service  - Could not initialize class AxisClient

    Robert Srna Newbie

      I'm developing a route which calls an external web service. It is a normal bean where  classes are generated from Eclipse (wsdl2java). It is working outside the Fuse e.g via junit.

       

      I had a lot of problems to get all needed libraries into osgi via install command e.g. I got Axis library through this install command:

      osgi:install -s mvn:org.apache.geronimo.bundles/axis/1.4_1

       

      My bundle seems to have no dependency missing and it is possible to start it. When I try to host this bean in Fuse like a regular bean target in camel route I get an error:

      "java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis.client.AxisClient".

       

      Any help is appreciated!

        • 1. Re: External web service  - Could not initialize class AxisClient
          Jon Calvert Newbie

          Having just dealt with this, I believe that you'll find the AxisClient can't initialize because it defines a static LogFactory and the logging mechanism for Axis1 is completely hosed.

           

          This JIRA issue was very illuminating:

           

          http://issues.ops4j.org/browse/PAXLOGGING-58

           

          Essentially what I did was tear open the Axis jar, and drop in the fixed LogFactory class. There was one other barrier to getting Axis1.4 working in FUSE 4.3. Axis has a dependency on javax.xml.rpc, so I snatched this bundle from the Spring EBR:

           

          https://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.javax.xml.rpc&version=1.1.0

           

          What this bundle does NOT do is export javax.xml.namespace, although it contains javax.xml.namespace.QName. The base FUSE package provides the javax.xml.namespace package, so you get a nice error like this:

           

          java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) previously initiated loading for a different type with name "javax/xml/namespace/QName"

           

          Of course, you don't know who the culprit is; so what I did, very crudely, was grep the bundles for QName and then compare this against a packages:imports | grep 'javax.xml.namespace'. Once I did that, the jig was up.

           

          The lesson for today might be that you should avoid Axis like the plague! I wouldn't be messing with it if I could avoid it.

          • 2. Re: External web service  - Could not initialize class AxisClient
            paul berry Newbie

            I realise this is an old issue, but I don't suppose anyone has a 'fixed' Axis1.4 Jar for this issue?  I'm having difficulty applying the patch discussed in the link (mostly use to me never having built anything using Ant, and this being an old issue) so if anyone has a Jar I could throw in as a workaround for this issue I'd be mopst grateful.