axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Rheinheimer <>
Subject Re: Class-cast exception - SOAPBodyElement
Date Wed, 07 Oct 2009 14:20:55 GMT
Hi Chris,

1)  yes, sort of
2)  in rt.jar from the Sun JVM
3)  maybe

:)  Sorry for the ambiguous answers.  The SAAJ factory implementations
that get picked up are defined by the META-INF/services/* files in the
axis2-saaj-1.5.jar library in the axis2 distribution, with the JVM
deciding who the default is if these services/* files don't get picked
up.  So, presumably that means this axis2-saaj-1.5.jar is not on the
classpath, or as you said, is being usurped by another jar that does
have the services/* files that points to the Sun SAAJ implementation.


On Wed, Oct 7, 2009 at 6:24 AM, Chris Mannion
<> wrote:
> Hi All
> I have an issue with one deployment of a piece of software I've
> written using Axis.  I have a web-service client that retrieves a
> javax.xml.soap.SOAPMessage as the service response, pulls out a
> javax.xml.soap.SOAPBody from that response and then gets the first
> body element from that to return as the service response.  The code
> for processing the response is as follows -
> SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
>    SOAPConnection con = scf.createConnection();
>    SOAPMessage response =, endpointAddress);
>    SOAPBody responseBody = response.getSOAPBody();
>    Iterator it = responseBody.getChildElements();
>    if(it.hasNext())
>    {
>      org.apache.axis.message.SOAPBodyElement next =
> (org.apache.axis.message.SOAPBodyElement);
>      StringWriter writer = new StringWriter();
>      next.output(new SerializationContext(writer));
>      String outputted = writer.toString();
>      return outputted;
>    }
> So, as you can see, the code assumed that Axis is the underlying
> implementation of the javax.xml.soap interfaces, so we can class-cast
> to an Axis SOAPBodyElement.  This usually works well because we deploy
> with Axis on the classpath so that it is picked up as the
> implmentation.  However, on one system the class-cast fails because
> the underlying object is
> com.sun.xml.internal.messaging.saaj.soap.ver1_1.BodyElement_1Impl.
> So, my questions are
> 1) Am I right in thinking that this is likely down to either the Axis
> jar being missing from the classpath, or another jar that implements
> javax.xml.soap has a higher priority on the classpath?
> 2) Does anyone know what jar file the
> com.sun.xml.internal.messaging.saaj.soap.ver1_1.BodyElement_1Impl
> class is likely to be being picked up from?  The saaj jar files I have
> on my own system don't include it, though I haven't had chance to
> investigate the problem system yet.
> 3) This is deployed in a Tomcat environment, are there any places in
> Tomcat or the JVM I should concentrate on looking for a jar file that
> is overriding the Axis jar (which should be in
> tomcat/webapps/<web-app>/WEB-INF/lib/)?
> Thanks so much for any help.
> --
> Chris Mannion

View raw message