ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Axis2调用超时Read timed out的解决办法一则

Axis2调用超时Read timed out的解决办法一则

原创 Linux操作系统 作者:heyanyang 时间:2009-08-19 15:55:13 0 删除 编辑

最近在使用Axis2时,在存根调用了服务上一个比较耗时的操作时,超时挂了。 上次使用Axis2没用出现超时问题.


最终通过设置存根每个方法的超时时间来解决。虽然很低级,但这样问题却解决了。

异常时堆栈信息如下:

org.apache.axis2.transport.http.HTTPSender  - Unable to sendViaPost to url [http://xxx.xxx.xxx.xxx:/SPWebService.asmx]
java.net.SocketTimeoutException: Read timed out

at java.net.SocketInputStream.socketRead0(Native Method)

at java.net.SocketInputStream.read(SocketInputStream.java:129)

at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)

at java.io.BufferedInputStream.read(BufferedInputStream.java:235)

at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)

at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)

at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)

at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)

at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)

at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)

at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)

at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)

at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)

at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)

at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)

at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:542)

at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:189)

at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)

at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:364)

at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:208)

at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)

at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)

at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)

at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)


解决办法:

在存根业务调用代码中进行设置,添加:
_operationClient.getOptions().setTimeOutInMilliSeconds(600000L);  //600*1000毫秒(10分钟
_operationClient表示一个客户端对象。

这个设置很不合理,但是没办法了,暂时先解决了问题再研究去。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16348848/viewspace-612689/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2008-10-10

  • 博文量
    5
  • 访问量
    30645