org.apache.commons.httpclient.ConnectionPoolTimeoutException: Timeout waiting for connection异常解决方案

问题描述:在较大并发情况下通过Axis2 v1.6生成的客户端掉相关服务,会持续抛出一下异常:

org.apache.commons.httpclient.ConnectionPoolTimeoutException: Timeout waiting for connection
   at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnecti
   at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHtt
   at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:153)
   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:199)
   at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
   at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSen
   at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
   at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)
   at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
   at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
   at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
   at com.*.*.mail.action.LoginAction.execute(LoginAction.java:81)
   at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
   at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
   at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
   at com.asiainfo.aiwm.mail.action.CommonInterceptor.intercept(CommonInterceptor.java:42)
   at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
   at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
   at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
   at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
   at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
   at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
   at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
   at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilt
   at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
   at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173)
   at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
   at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:274)
   at com.caucho.server.port.TcpConnection.run(TcpConnection.java:514)
   at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:527)
   at com.caucho.util.ThreadPool.run(ThreadPool.java:449)
   at java.lang.Thread.run(Thread.java:595)

解决方案:

网上提供的解决方案,包括官网提供的解决方案,基本上都为在每次请求完后调用以下方法

_getServiceClient ().cleanupTransport ();

但经过测试发现异常依旧,暂时将客户端版本降至1.5解决了该问题。


你可能感兴趣的:(webservice)