1

尝试在客户端接收 resteasy web 服务的响应时出现异常。我的响应类包括另一个 Jaxb 类,其中包含一个 ArrayList。

clientRequest = new ClientRequest("myserviceurl");
clientRequest.body(MediaType.APPLICATION_XML, myreqdetail);
clientResponse = clientRequest.post(MyResponseDetail.class);
myResponseDetail =  clientResponse.getEntity();

在使用上面的代码片段时,出现以下错误。,

[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]. StandardWrapper.Throwable: java.lang.RuntimeException: Unable to find a public constructor for class org.jboss.resteasy.core.AsynchronousDispatcher
at org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory.registered(POJOResourceFactory.java:35) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:121) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:107) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:84) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:73) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:367) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:225) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_06]



ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]  Allocate exception for servlet javax.ws.rs.core.Application: java.lang.RuntimeException: Unable to find a public constructor for class org.jboss.resteasy.core.AsynchronousDispatcher
 at org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory.registered(POJOResourceFactory.java:35) [resteasy-jaxrs-2.3.2.Final.jar:]
 at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:121) [resteasy-jaxrs-2.3.2.Final.jar:]

 at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) [resteasy-jaxrs-2.3.2.Final.jar:]
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
 at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.13.Final.jar:]
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.13.Final.jar:]
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
 at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
 at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_06]



org.jboss.resteasy.client.ClientResponseFailure: Unable to find a MessageBodyReader of content-type text/html;charset="utf-8" and type null
       at org.jboss.resteasy.client.core.BaseClientResponse.createResponseFailure(BaseClientResponse.java:523)
       at org.jboss.resteasy.client.core.BaseClientResponse.createResponseFailure(BaseClientResponse.java:514)
       at org.jboss.resteasy.client.core.BaseClientResponse.readFrom(BaseClientResponse.java:415)
       at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:377)
       at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:338)
       at MyBean.mygetmethod(MyBean.java:401)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
       at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
       at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
       at com.sun.faces.facelets.tag.jsf.core.DeclarativeSystemEventListener.processEvent(EventHandler.java:128)
       at javax.faces.component.UIComponent$ComponentSystemEventListenerAdapter.processEvent(UIComponent.java:2486)
       at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)
       at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2168)
       at com.sun.faces.application.ApplicationImpl.invokeComponentListenersFor(ApplicationImpl.java:2116)
       at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:288)
       at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:246)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
       at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
       at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
       at java.lang.Thread.run(Thread.java:619)

我不知道那出了什么问题。我是否需要为此添加任何特定的罐子。请提供任何关于此的想法。

我的 JAXB 课程:

@XmlRootElement(name="Serviceresponse")

公共类 MyResponseDetail {

private String employeename;

private String age;

private String department;

private Additionaldetail adetail;

//getters and setters

}

@XmlRootElement(name="assitionaldetail") 公共类 AdditionalDetail {

private ArrayList worksdone;

private String address;

}

我已经单独包含了 resteasy-jaxrs-2.3.2.Final.jar。

4

0 回答 0