gpt4 book ai didi

java - Jboss EAP 6.1 中的 RestEasy 冲突

转载 作者:行者123 更新时间:2023-12-01 17:16:43 24 4
gpt4 key购买 nike

我正在尝试使用 Jersey 创建 RESTful API。我的 pom.xml 如下所示:

<!-- Jersey Library -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>

但是在 Jboss 中部署应用程序时,我收到 Only one JAX-RS Application Class allowed. 异常。然而,这对于 tomcat 来说非常有效。

堆栈跟踪:

ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."apiinterface.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."apiinterface.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "apiinterface.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Final-redhat-4.jar:7.2.0.Final-redhat-4]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011232: Only one JAX-RS Application Class allowed. com.sun.jersey.api.core.ClasspathResourceConfig com.sun.jersey.api.core.DefaultResourceConfig com.sun.jersey.server.impl.application.DeferredResourceConfig com.sun.jersey.api.core.servlet.WebAppResourceConfig com.sun.jersey.api.core.DefaultResourceConfig com.sun.jersey.api.core.ApplicationAdapter com.sun.jersey.api.core.ClassNamesResourceConfig com.sun.jersey.api.core.ResourceConfig com.sun.jersey.api.core.ApplicationAdapter com.sun.jersey.api.core.ClasspathResourceConfig com.sun.jersey.server.impl.application.DeferredResourceConfig com.sun.jersey.api.core.ScanningResourceConfig com.sun.jersey.api.core.ScanningResourceConfig com.sun.jersey.api.core.PackagesResourceConfig com.sun.jersey.api.core.ClassNamesResourceConfig com.sun.jersey.api.core.PackagesResourceConfig com.sun.jersey.api.core.ResourceConfig
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:206)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:104)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Final-redhat-4.jar:7.2.0.Final-redhat-4]
... 5 more

我尝试实现 Deploying a Jersey webapp on Jboss AS 7 的答案但到目前为止还没有成功。

最佳答案

JBoss AS/EAP 已经为您提供了 JAX-RS 实现 (RESTEasy),因此您的 pom.xml 应该只包含对 JAX-RS API 的依赖项(范围提供)。

如果您想在 Tomcat 和/或 JBoss AS 上构建和部署,您应该使用 Maven 配置文件并仅在 Tomcat 配置文件中包含 Jersey 工件。

关于java - Jboss EAP 6.1 中的 RestEasy 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21547157/

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