我正在开发webservice,我遇到如下问题:
org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError:无法初始化类 org.apache.http.impl.conn.ManagedHttpClientConnectionFactory org.jboss.resteasy.core.SynchronousDispatcher.unwrapException(SynchronousDispatcher.java:345) org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:321) org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:214) org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:190) org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:534) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
根本原因
java.lang.NoClassDefFoundError:无法初始化类 org.apache.http.impl.conn.ManagedHttpClientConnectionFactory org.apache.http.impl.conn.PoolingHttpClientConnectionManager $ InternalConnectionFactory。(PoolingHttpClientConnectionManager.java:487) org.apache.http.impl.conn.PoolingHttpClientConnectionManager。(PoolingHttpClientConnectionManager.java:147) org.apache.http.impl.conn.PoolingHttpClientConnectionManager。(PoolingHttpClientConnectionManager.java:136) org.apache.http.impl.conn.PoolingHttpClientConnectionManager。(PoolingHttpClientConnectionManager.java:112) org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:727) org.apache.http.impl.client.HttpClients.createDefault(HttpClients.java:58) com.cns.atta.rest.actions.attaFileUploadActions.uploadToGSFS(attaFileUploadActions.java:443) com.cns.atta.rest.actions.attaFileUploadActions.doRequiredWorks(attaFileUploadActions.java:197) com.cns.atta.rest.actions.attaFileUploadActions.uploadFileXML(attaFileUploadActions.java:89) sun.reflect.GeneratedMethodAccessor501.invoke(未知来源) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:616) org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:255) org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:220) org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:209) org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:519) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
库是/jboss-eap-5.1/resteasy/lib/httpclient-4.0.jar"/。应用程序在Jboss 5 EAP服务器servlet容器上运行。它将作为war文件部署到服务器。
因为缺少课程managedHttpClientConnectionFactory
。
我的问题是我可以将httpclient-4.3.jar用于Jboss 5 EAP吗?因为这个类是可用的,或者有另一个解决方案来避免这个错误。 关于这个的任何想法?
代码是:
Line number 443 : CloseableHttpClient client = HttpClients.createDefault();
try {
HttpPost postRequest = new HttpPost(attaActionContextListener
.getINSTANCE().getGsfsAddress());
// Set various attributes
// FileBody fileBody = new FileBody(file);
HttpEntity reqEntity = null; ...
行号197:parseServerResponse(uploadToGSFS(model,actionType),model); 第89行:返回doRequiredWorks(输入,ActionType.INSERT);