This issue[1] you might face when you run your axis2client code in a loop against a service..
To overcome above issue, set the "MULTITHREAD_HTTP_CONNECTION_MANAGER" property in the axis2 ConfigurationContext.
[1]
Caused by: org.apache.axis2.AxisFault: Timeout waiting for connection
at org.apache.axis2.AxisFault.
makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
To overcome above issue, set the "MULTITHREAD_HTTP_CONNECTION_MANAGER" property in the axis2 ConfigurationContext.
ConfigurationContext configContext = ConfigurationContextFactory. createConfigurationContextFromFileSystem("CARBON_HOME\\repository\\deployment\\client", "CARBON_HOME\\repository\\conf\\axis2_client.xml");
MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
configContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, httpConnectionManager);
[1]
Caused by: org.apache.axis2.AxisFault: Timeout waiting for connection
at org.apache.axis2.AxisFault.
at org.apache.axis2.transport.
at org.apache.axis2.transport.
Caused by: org.apache.commons.httpclient.
ConnectionPoolTimeoutException:
Timeout waiting for connection
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.doGetConnection(MultiThreadedHttpConnectionManager.java:490)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.getConnectionWithTimeout(MultiThreadedHttpConnectionManager.java:394)
Timeout waiting for connection
at org.apache.commons.httpclient.
at org.apache.commons.httpclient.
Good case, Thanks.
ReplyDeletecan also be done this way:
ReplyDeleteMultiThreadedHttpConnectionManager manager = new MultiThreadedHttpConnectionManager();
manager.getParams().setDefaultMaxConnectionsPerHost(threads);
HttpClient client = new HttpClient(manager);
stub._getServiceClient().getServiceContext().getConfigurationContext().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, client);
Thanks
Thanks Marisusz..would be helpful to others..
Delete