I'm having a heck of a time getting a pooling connection manager to work for Resteasy clients. Deploying on Wildfly 8.1.
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine;
...
PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
cm.setMaxTotal(200);
cm.setDefaultMaxPerRoute(20);
HttpClient httpClient = new DefaultHttpClient(cm);
ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient);
ResteasyClient resteasyClient = new ResteasyClientBuilder().httpEngine(engine).build();
I'm getting the error:
19:04:59,355 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "ESM2.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"ESM2.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"ESM2.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"ESM2.war\"
Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class com.xxx.esm2.server.webservices.rest.arcgis.ClientBean with ClassLoader ModuleClassLoader for Module \"deployment.ESM2.war:main\" from Service Module Loader
Caused by: java.lang.NoClassDefFoundError: org/apache/http/conn/ClientConnectionManager
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.ClientConnectionManager from [Module \"deployment.ESM2.war:main\" from Service Module Loader]"}}
here is the entry from the POM:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
<scope>provided</scope>
</dependency>
The jar is already in the Wildfly modules directory, hence the provided scope.
How do I properly add and configure a pooled connection manager for Resteasy clients?