jersey - 在JBoss应用程序中,集成jersey库

  显示原文与译文双语对照的内容

我正在尝试将Java客户端加入到 Jboss Web应用程序中。 当我创建概念( POC )的证明独立应用程序时,它不需要集成 Jersey 库。

但是,当我在Jboss应用程序中集成相同的POC模块时,它出现了以下异常。


13:37:20,261 WARN [org.jboss.modules] (http--0.0.0.0-8080-2) Failed to define class org.apache.hadoop.hdfs.web.resources.UserProvider in Module"deployment.HFPlatform.ear:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/apache/hadoop/hdfs/web/resources/UserProvider (Module"deployment.HFPlatform.ear:main" from Service Module Loader)
 at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
 at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
 at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
 at org.jboss.modules.Module.loadModuleClass(Module.java:517)
 at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
 at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
 at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
 at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
 at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
 at org.jboss.resteasy.spi.ResteasyDeployment.registerProvider(ResteasyDeployment.java:499) [resteasy-jaxrs-2.3.2.Final.jar:]
 at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:305) [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.Final]
. 
. 
. 
Caused by: java.lang.NoClassDefFoundError: com/sun/jersey/spi/inject/InjectableProvider
 at java.lang.ClassLoader.defineClass1(Native Method) [classes.jar:1.6.0_65]
 at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) [classes.jar:1.6.0_65]
 at java.lang.ClassLoader.defineClass(ClassLoader.java:621) [classes.jar:1.6.0_65]
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [classes.jar:1.6.0_65]
 at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)

为了解决以下类问题,我添加了 Jersey jar 。


Caused by: java.lang.NoClassDefFoundError: com/sun/jersey/spi/inject/InjectableProvider

然后开始给出以下问题


13:56:11,021 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.unit."HFPlatform.ear".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."HFPlatform.ear".POST_MODULE: Failed to process phase POST_MODULE of deployment"HFPlatform.ear"
 at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
 at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [classes.jar:1.6.0_65]
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [classes.jar:1.6.0_65]
 at java.lang.Thread.run(Thread.java:695) [classes.jar:1.6.0_65]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011232: Only one JAX-RS Application Class allowed. com.sun.jersey.api.core.ScanningResourceConfig com.sun.jersey.api.core.WebAppResourceConfig com.sun.jersey.server.impl.application.DeferredResourceConfig com.sun.jersey.api.core.ResourceConfig com.sun.jersey.api.core.ClassNamesResourceConfig com.sun.jersey.api.core.ClasspathResourceConfig com.sun.jersey.api.core.ApplicationAdapter org.apache.hadoop.hbase.rest.ResourceConfig com.sun.jersey.api.core.PackagesResourceConfig com.sun.jersey.api.core.DefaultResourceConfig
 at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:209)
 at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:101)
 at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

请帮我解决这个问题。 独立HBase没有 Jersey 工作,但这不能与JBoss一起工作。

时间: 作者:

异常是说你有多个jax提供程序提供者。 默认情况下Jboss附带 resteasy jars 。 从你的类路径中删除 resteasy jars 。 它应该能工作。

或者

检查任何其他 jax rs提供程序 jar 在你的类路径中。

作者:
...