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

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

Axis2不是个省油的灯,用起来一直不爽,现在项目快结束了,用着玩意想吐!
 
我是用服务端+客户端存根来使用Axis2的,在存根调用了服务上一个比较耗时的操作时,超时挂了。

首先我就开始在应用服务器JBOSS上到处修改超时时间为600*1000毫秒(10分钟)。可测试时候还继续超时。
 
查看网上,有很多人也遇到我一样的问题,都是增大超时时间,可是在jboss上设置没用啊!
 
最终通过设置存根每个方法的超时时间来解决。虽然很低级,但这样问题却解决了。
 
异常时堆栈信息如下:
14:02:52,582 INFO    [STDOUT] 2009-05-04 14:02:52    - INFO    org.apache.axis2.transport.http.HTTPSender         - Unable to sendViaPost to url[http://192.168.50.170:80/ccmweb/services/ccmws.ccmwsHttpSoap12Endpoint] 
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) 
  at zzvcom.cms.ccm.wsclient.ccmws.CcmwsStub.genProgramPutInfoList(CcmwsStub.java:828) 
  at zzvcom.cms.ccm.wsclient.CcmWSClient.genProgramPutInfoList(CcmWSClient.java:286) 
  at zzvcom.cms.ccm.service.impl.ProgramServiceImpl.getWaitingProgramInfo(ProgramServiceImpl.java:1125) 
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
  at java.lang.reflect.Method.invoke(Method.java:585) 
  at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) 
  at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) 
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) 
  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) 
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
  at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) 
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) 
  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) 
  at $Proxy66.getWaitingProgramInfo(Unknown Source) 
  at zzvcom.cms.ccm.action.ProgramAction.stockProgram(ProgramAction.java:2026) 
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
  at java.lang.reflect.Method.invoke(Method.java:585) 
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
  at zzvcom.cms.sys.authen.web.AuthFilterForCas.doFilter(AuthFilterForCas.java:128) 
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
  at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:87) 
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
  at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:78) 
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
  at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) 
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 
  at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179) 
  at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) 
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) 
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) 
  at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) 
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241) 
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) 
  at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580) 
  at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) 
  at java.lang.Thread.run(Thread.java:595) 
Caused by: 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. 


 

解决办法:
 
在存根业务调用代码中进行设置,添加:
_operationClient.getOptions().setTimeOutInMilliSeconds(600000L);
_operationClient表示一个客户端对象。
 
这个设置很不合理,但是没办法了,暂时先解决了问题再研究去。


本文转自 leizhimin 51CTO博客,原文链接:http://blog.51cto.com/lavasoft/155093,如需转载请自行联系原作者
上一篇:数据恢复专业基础之python解释NTFS runlist的代码


下一篇:接口测试框架实战(五) | 测试数据的数据驱动