You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airavata.apache.org by BA...@nationwide.com on 2014/12/29 22:52:17 UTC

REQUEST For response: [jira] [Created] (AIRAVATA-711) Timeout waiting for connection

Hi,
  I am getting following error from my application, we are using axis2 
1.6.2 version.

Caused by: org.apache.commons.httpclient.ConnectionPoolTimeoutException: 
Timeout waiting for connection
at 
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnectionManager.java:497)
at 
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHttpConnectionManager.java:416)
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)

As per google forum  suggestions, I tried all options where in setting 
properties to ConfigurationContext. Its throwing another error saying 
java.lang.ClassCastException: org.apache.commons.httpclient.HttpClient 
incompatible with org.apache.commons.httpclient.HttpClient
at 
org.apache.axis2.transport.http.AbstractHTTPSender.getHttpClient(AbstractHTTPSender.java:493)


import org.apache.axis2.client.Stub;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;

private void setContextProperties(Stub stub) {
ConfigurationContext context = 
stub._getServiceClient().getServiceContext().getConfigurationContext();
context.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, true);
context.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, true); 
MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager = 
new MultiThreadedHttpConnectionManager(); 
HttpConnectionManagerParams params = new HttpConnectionManagerParams(); 
params.setDefaultMaxConnectionsPerHost(20); //Set this value as per your 
need.
multiThreadedHttpConnectionManager.setParams(params); 
HttpClient httpClient = new 
HttpClient(multiThreadedHttpConnectionManager); 
context.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); 
}

Could you please check and let me know your thoughts on resolving this 
issue? Your response is appreciated & Thanks in advance.

Thanks,
kalyani.