axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Lovett (JIRA)" <>
Subject [jira] Created: (AXIS2-2147) Class cast exception due to overloaded use of a constant
Date Fri, 09 Feb 2007 12:03:05 GMT
Class cast exception due to overloaded use of a constant

                 Key: AXIS2-2147
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: kernel
            Reporter: Matt Lovett

When using Sandesha, messages may be retransmitted. When running the unit tests that exercise
this, we are getting a 
class cast exception the second time that we send a message. Here's the java stack trace:

10943 [Axis2 Task] ERROR org.apache.sandesha2.workers.SenderWorker  - Sandesha2 got an exception
when sending a message: java.lang.ClassCastException: org.apache.commons.httpclient.methods.PostMethod
incompatible with java.lang.String.
java.lang.ClassCastException: org.apache.commons.httpclient.methods.PostMethod incompatible
with java.lang.String
	at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(
	at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(
	at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
	at org.apache.axis2.engine.AxisEngine.resumeSend(

The code that is executing is the cast to String of 'httpMethod'

    public void send(MessageContext msgContext, OMElement dataout, URL url, String soapActionString)
            throws MalformedURLException, AxisFault, IOException {
        // execute the HtttpMethodBase - a connection manager can be given for
        // handle multiple

        String httpMethod =
                (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);

        if ((httpMethod != null)
                && Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod))
            this.sendViaGet(msgContext, url, soapActionString);

        this.sendViaPost(msgContext, dataout, url, soapActionString);

I think the root cause is probably due to two contstants having the same value, and both being
used as keys into the MessageContext properties:

org.apache.axis2.transport.http.HTTPConstants.HTTP_METHOD = "HTTP_METHOD"
org.apache.axis2.Constants.Configuration.HTTP_METHOD = "HTTP_METHOD"

I think that the HTTPConstants one is written part way through the first send, making a side-effect
that poisons the second send. This is when using Sandesha without calling the MessageContext
serialization code, persumably if we were using that we would avoid the issue.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message