axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thilo Frotscher (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Commented: (AXIS-2121) CLONE -IncompatibleClassChangeError when deploying Axis 1.2-RC3 on WebSphere 5.1 with PARENT_FIRST classloading
Date Thu, 21 Jul 2005 15:43:00 GMT
    [ http://issues.apache.org/jira/browse/AXIS-2121?page=comments#action_12316364 ] 

Thilo Frotscher commented on AXIS-2121:
---------------------------------------

I investigated further on this issue and found out the following. In my case, the real trouble
occurs in class SOAPFaultBuilder. One of my client apps sends a request to a service, and
if the server returns a response with a SOAP fault, this SOAP fault can't be deserialized.
The reason: look at the following method in SOAPFaultBuilder

    public void onEndChild(String namespace, String localName,
                           DeserializationContext context)
            throws SAXException {
        if (Constants.ELEM_FAULT_DETAIL.equals(localName)) {
            MessageElement el = context.getCurElement();
            List children = el.getChildren();
            if (children != null) {
                Element [] elements = new Element [children.size()];
                for (int i = 0; i < elements.length; i++) {
                    try {
                        elements[i] = ((MessageElement)children.get(i)).
                                                                    getAsDOM();
                        
                    } catch (Exception e) {
                        throw new SAXException(e);
                    }
                }
                faultDetails = elements;
            }
        }
    }


Inside the try-statement there is a cast to MessageElement. However, children.get(i) returns
an instance of  org.apache.axis.message.Text (this could be a result of the patch we see
above and that was included for Axis 1.2.1). Instances of Text cannot be cast to MessageElement,
because Text extends NodeImpl. This results in a ClassCastException in SOAPFaultBuilder.

Possible solution: MessageElement extends NodeImpl as well. So my suggestion would be to let
org.apache.axis.message.Text extend MessageElement instead of NodeImpl. But I don't know if
this would have any negative implications. So dims, please decide if that would be possible.
Thanks.

Another option: actually the method getAsDOM is needed in Text. Maybe just this method could
be moved from MessageElement to a common super class of MessageElement and Text?









> CLONE -IncompatibleClassChangeError when deploying Axis 1.2-RC3 on WebSphere 5.1 with
PARENT_FIRST classloading
> ---------------------------------------------------------------------------------------------------------------
>
>          Key: AXIS-2121
>          URL: http://issues.apache.org/jira/browse/AXIS-2121
>      Project: Apache Axis
>         Type: Bug
>   Components: SAAJ
>     Versions: 1.2RC3
>  Environment: WebSphere 5.1.x on Linux (2.4.x kernel).
>     Reporter: Thilo Frotscher
>     Priority: Blocker

>
> I am deploying Axis 1.2RC3 in a war that resides within an ear. The axis jars are in
the war/WEB-INF/lib dir. For various reasons related to the other contents of my ear, I must
use PARENT_FIRST classloading. As many have reported, if you have PARENT_FIRST classloading
on WebSphere 5.1 with Axis 1.2RC3, then there is a conflict between the version of saaj (1.1)
that ships with WebSphere, and the version of saaj (1.2) that Axis 1.2RC3 expects, and you
get the following exception:
>  
> java.lang.IncompatibleClassChangeError: class org.apache.axis.SOAPPart does not implement
interface org.w3c.dom.Document
>  
> This issue can be resolved with PARENT_LAST classloading and a manifest which specifies
the classpath...but for those of use who can't use PARENT_LAST classloading, there is another
option.
>  
> It appears that a single source code change to Axis will eliminate the issue altogether.
The offending code is in org.apache.axis.message.MessageElement.addTextNode(), and can be
patched as follows:
>  
> OLD CODE:
>  
> public SOAPElement addTextNode(String s) throws SOAPException {
>     try {
>             Text text = getOwnerDocument().createTextNode(s);
>             ((org.apache.axis.message.Text)text).setParentElement(this);
>             return this;
>         } catch (ClassCastException e) {
>             throw new SOAPException(e);
>         }
> }
>  
> PATCHED CODE:
>  
> public SOAPElement addTextNode(String s) throws SOAPException {
>     try {
>             Text text = new org.apache.axis.message.Text(s);
>             this.appendChild(text);
>             return this;
>         } catch (ClassCastException e) {
>             throw new SOAPException(e);
> }
>  
> After making this change, Axis 1.2RC3 will run on WebSphere 5.1 with PARENT_FIRST classloading,
and no exceptions will be thrown.
>  
> -DT
>  
> ---------------------------------
> David Tompkins
> Sr. Computer Scientist
> Adobe Systems, Inc.
> tompkins _AT_ adobe _DOT_ com
> http://www.dt.org/

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message