将 Maven 依赖项添加到 hadoop-azure 后,Webapp 失败并显示 "JBAS011232: Only one JAX-RS Application Class allowed"

Webapp fails with "JBAS011232: Only one JAX-RS Application Class allowed" after adding a maven dependency to hadoop-azure

我有一个在 JBoss EAP 6.4 中运行良好的网络应用程序。我想向我的 webapp 添加一些功能,以便它可以处理驻留在 AzureBlob 存储中的 Parquet 文件。我向 pom.xml:

添加了一个依赖项
    <dependency>
        <groupId>org.apache.hadoop</groupId>
        <artifactId>hadoop-azure</artifactId>
        <version>3.1.0</version>
    </dependency>

如果我现在尝试启动我的网络应用程序,它会在启动时失败:

09:29:43,703 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-10) MSC000001: Failed to start service jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "myApp-0.0.1-SNAPSHOT.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1] ... Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011232: Only one JAX-RS Application Class allowed. com.sun.jersey.api.core.ResourceConfig com.sun.jersey.api.core.DefaultResourceConfig com.sun.jersey.api.core.PackagesResourceConfig com.mycompany.myapp.rest.RestApplication com.sun.jersey.api.core.ClassNamesResourceConfig com.sun.jersey.api.core.ScanningResourceConfig com.sun.jersey.api.core.servlet.WebAppResourceConfig com.sun.jersey.api.core.ApplicationAdapter com.sun.jersey.server.impl.application.DeferredResourceConfig com.sun.jersey.api.core.ClasspathResourceConfig 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:159) [jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] ... 5 more

09:29:43,709 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014612: Operation ("deploy") failed - address: ([("deployment" => "myApp-0.0.1-SNAPSHOT.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "myApp-0.0.1-SNAPSHOT.war" Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011232: Only one JAX-RS Application Class allowed. com.sun.jersey.api.core.ResourceConfig com.sun.jersey.api.core.DefaultResourceConfig com.sun.jersey.api.core.PackagesResourceConfig com.mycompany.myapp.rest.RestApplication com.sun.jersey.api.core.ClassNamesResourceConfig com.sun.jersey.api.core.ScanningResourceConfig com.sun.jersey.api.core.servlet.WebAppResourceConfig com.sun.jersey.api.core.ApplicationAdapter com.sun.jersey.server.impl.application.DeferredResourceConfig com.sun.jersey.api.core.ClasspathResourceConfig"}}

消息“JBAS011232:只允许一个 JAX-RS 应用程序 Class”似乎是由我的 webapp 试图同时使用 RestEasy 和 Jersey 引起的。 JBoss 默认使用 RestEasy。显然,hadoop-azure 必须有一个 Jersey 应用程序 class。如何通过指示我不想使用基于 Jersey 的应用程序来消除此问题 class?

hadoop-azure 拉入 hadoop-common,这拉入泽西岛。在您使用的 hadoop-azure 版本中,hadoop-commoncompile <scope> 中。在新版本中,它在 provided 范围内。所以你可以把 hadoop-azure 依赖升级到最新的。如果你需要 hadoop-common 来编译,那么你可以重新声明 hadoop-common 并将它放在 provided 范围内。