在JBoss应用程序中集成jersey库

时间:2014-01-15 12:41:27

标签: jersey jboss7.x hbase

我正在尝试将Java客户端HBase导入Jboss Web应用程序。当我创建一个独立的应用程序概念证明(POC),用于HBase访问时,它不需要集成泽西库。

但是当我在Jboss Web App中集成相同的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)

为了解决以下课程问题,我添加了泽西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没有运动衫,但这不适用于JBoss。

1 个答案:

答案 0 :(得分:1)

例外情况是说您有多个JAX-RS提供程序。 默认情况下,Jboss附带resteasy个罐子。从类路径中删除 resteasy jar。它应该工作。

OR

检查任何其他JAX-RS提供程序jar是否在您的类路径中。