You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Chamikara Jayalath (JIRA)" <ji...@apache.org> on 2007/02/09 17:00:05 UTC
[jira] Commented: (AXIS2-2147) Class cast exception due to
overloaded use of a constant
[ https://issues.apache.org/jira/browse/AXIS2-2147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12471734 ]
Chamikara Jayalath commented on AXIS2-2147:
-------------------------------------------
Hi Matt,All,
In case U hvn't seen already the reason is the line 534 in AbstractHTTPSender,
msgContext.setProperty(HTTPConstants.HTTP_METHOD, method);
What we should be putting is the String value (POST, GET etc.) not the method object.
Or is this property set really needed ?
Chamikara
> 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.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org