gpt4 book ai didi

java - JBOSS 7.1.0 错误 - 找不到类 org.jboss.resteasy.core.AsynchronousDispatcher 的公共(public)构造函数

转载 作者:IT老高 更新时间:2023-10-28 13:47:47 25 4
gpt4 key购买 nike

我正在尝试将基于 Spring MVC 的 REST 应用程序迁移到 Jboss 7.1.0。在启动时,Jboss 初始化显示一切都已正确启动,所有 war 文件都已成功部署。

我在集成 Spring MVN 和 Jboss 的 RestEasy 服务时遇到了很多问题,我想知道这是否是 jboss resteasy 与 Spring MVN 之间的另一个冲突。

当我向 REST 服务发出请求时,我收到以下错误:

12:52:31,541 INFO  [org.springframework.web.context.ContextLoader] (MSC service thread 1-5) Root WebApplicationContext: initialization completed in 3035 ms
12:52:31,845 INFO [org.jboss.web] (MSC service thread 1-5) JBAS018210: Registering web context: /MyRestService
12:52:31,875 INFO [org.jboss.as] (MSC service thread 1-5) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 53526ms - Started 390 of 468 services (72 services are passive or on-demand)
12:52:32,034 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "MyRestService.war"
12:54:10,117 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/MyRestService]] (http--127.0.0.1-8080-1) 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.1.GA.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:121) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:107) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:84) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:73) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:367) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:225) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]

12:54:10,194 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/MyRestService].[javax.ws.rs.core.Application]] (http--127.0.0.1-8080-1) 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.1.GA.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:121) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:107) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:84) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:73) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:367) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:225) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) [resteasy-jaxrs-2.3.1.GA.jar:]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]

这个错误没有任何意义,我唯一能认出的是 RESTEasy 服务 servlet 名称。配置如下 - 在 Jboss 7.0.2 中运行良好

<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

最佳答案

在 JBoss 7.1.1(没有 Spring)上使用 RESTEasy 时,我也看到了这个异常。它是这样包装的:

Allocate exception for servlet [project class reference]: java.lang.RuntimeException: Unable to find a public constructor for class org.jboss.resteasy.core.AsynchronousDispatcher

解决方案是从 war 中排除所有 RESTEasy jar 。在 Maven 中,您可以通过确保在 Maven 的“提供”范围内声明任何必需的 RESTEasy 依赖项来做到这一点,因为这些是由 JBoss 提供的,并且排除任何传递性 RESTEasy 依赖项(参见 this link 示例)。您可以通过切换到包含 pom.xml 的目录并发出以下命令来检查您是否有任何 RESTEasy 依赖项:

mvn dependency:tree | grep "resteasy"

如果您使用 web.xml 来激活 JAX-RS,您可能还需要切换到演示的基于类的方法 in the RESTEasy docs . RESTEasy 开发人员 here 提到了此问题的这些解决方案。和 here .

关于java - JBOSS 7.1.0 错误 - 找不到类 org.jboss.resteasy.core.AsynchronousDispatcher 的公共(public)构造函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9378106/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com