You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by Matthew Lovett <ML...@uk.ibm.com> on 2007/02/09 13:04:49 UTC

Fw: [jira] Created: (AXIS2-2147) Class cast exception due to overloaded use of a constant

Hi all,

Just FYI, but there seems to be an upstream regression that stops us 
retransmitting messages.

Thanks,

Matt


----- Forwarded by Matthew Lovett/UK/IBM on 09/02/2007 12:04 -----

"Matt Lovett (JIRA)" <ji...@apache.org> 
09/02/2007 12:03

To
Matthew Lovett/UK/IBM@IBMGB
cc

Subject
[jira] Created: (AXIS2-2147) Class cast exception due to overloaded use of 
a constant






Class cast exception due to overloaded use of a constant
--------------------------------------------------------

                 Key: AXIS2-2147
                 URL: https://issues.apache.org/jira/browse/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(SOAPOverHTTPSender.java:48)
                 at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:349)
                 at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:208)
                 at 
org.apache.axis2.engine.AxisEngine.resumeSend(AxisEngine.java:383)
                 at 
org.apache.sandesha2.workers.SenderWorker.run(SenderWorker.java:228)
                 at 
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
                 at 
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
                 at java.lang.Thread.run(Thread.java:788)

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);

            return;
        }
        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"
and
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.







Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU







---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org