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

查看:1711
本文介绍了Wildfly 8.1 ClassNotFound org.apache.http.conn.ClientConnectionManager的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段时间让一个联合连接管理器为Resteasy客户工作。
在Wildfly 8.1上部署。

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();

我收到错误:

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]"}}

这是来自POM的条目:

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>

jar已经在Wildfly模块目录中,因此提供了范围。

The jar is already in the Wildfly modules directory, hence the provided scope.

如何为Resteasy客户正确添加和配置池连接管理器?

How do I properly add and configure a pooled connection manager for Resteasy clients?

推荐答案

罐子在modules目录中,大多数都是屏蔽你的,并且可以使用服务器实现。例外是暴露Java EE API的例外。

Jars in the modules directory are mostly shielded from you and are there for the use of the server implementation. Exceptions are those that expose the Java EE APIs.

最简单的解决方案是在您的应用程序中包含此jar。

The easiest solution for you is to just include this jar in your application.

或者,你可以编写一个jboss-deployment-structure.xml文件,如在WildFly中加载类

Alternatively, you could compose a jboss-deployment-structure.xml file as described in Class Loading in WildFly.

例如:

<?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>

这篇关于Wildfly 8.1 ClassNotFound org.apache.http.conn.ClientConnectionManager的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆