简体   繁体   English

Wildfly 8.1 ClassNotFound org.apache.http.conn.ClientConnectionManager

[英]Wildfly 8.1 ClassNotFound org.apache.http.conn.ClientConnectionManager

I'm having a heck of a time getting a pooling connection manager to work for Resteasy clients. 我有一段时间让一个联合连接管理器为Resteasy客户工作。 Deploying on Wildfly 8.1. 在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: 这是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. jar已经在Wildfly模块目录中,因此提供了范围。

How do I properly add and configure a pooled connection manager for Resteasy clients? 如何为Resteasy客户端正确添加和配置池连接管理器?

Jars in the modules directory are mostly shielded from you and are there for the use of the server implementation. 模块目录中的jar大多数都是屏蔽的,可以使用服务器实现。 Exceptions are those that expose the Java EE APIs. 例外是那些公开Java EE API的例外。

The easiest solution for you is to just include this jar in your application. 最简单的解决方案是在您的应用程序中包含此jar。

Alternatively, you could compose a jboss-deployment-structure.xml file as described in Class Loading in WildFly . 或者,您可以编写一个jboss-deployment-structure.xml文件,如WildFly中的类加载中所述

For example: 例如:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <dependencies>
            <module name="org.apache.httpcomponents"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NoClassDefFoundError:org / apache / http / conn / SchemePortResolver-硒 - NoClassDefFoundError: org/apache/http/conn/SchemePortResolver - Selenium org.apache.http.conn.HttpHostConnectException:拒绝连接到http:// localhost - org.apache.http.conn.HttpHostConnectException: Connection to http://localhost refused java.lang.NoClassDefFoundError:org / apache / http / impl / conn / PoolingClientConnectionManager - java.lang.NoClassDefFoundError: org/apache/http/impl/conn/PoolingClientConnectionManager java.lang.NoClassDefFoundError:带有AmazonHttpClient的org / apache / http / conn / SchemePortResolver - java.lang.NoClassDefFoundError: org/apache/http/conn/SchemePortResolver with AmazonHttpClient Websphere httpclient NoSuchMethodError org.apache.http.conn.Scheme - Websphere httpclient NoSuchMethodError org.apache.http.conn.Scheme NoSuchMethodError org.apache.http.conn.scheme.Scheme - NoSuchMethodError org.apache.http.conn.scheme.Scheme 是否可以窥视HttpClient的org.apache.http.conn.EofSensorInputStream? - Is it possible to peek HttpClient's org.apache.http.conn.EofSensorInputStream? java.lang.NoClassDefFoundError:org / apache / http / nio / conn / NHttpClientConnectionManager - java.lang.NoClassDefFoundError: org/apache/http/nio/conn/NHttpClientConnectionManager Java Firebase错误“ NoClassDefFoundError:org / apache / http / conn / ssl / StrictHostnameVerifier” - Java Firebase error “NoClassDefFoundError: org/apache/http/conn/ssl/StrictHostnameVerifier” org.apache.http.conn.HttpHostConnectException:连接到127.0.0.1:7055 - org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:7055
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM