在Jboss 7.1.1 final上部署时,Jersey 1.18.1无法选择我的restful服务

时间:2014-06-27 06:40:26

标签: rest jboss jersey-1.0

我有一个非常令人困惑的问题。我有一个eclipse Restful服务项目,由gradle构建。我可以在Eclipse中成功地在Tomcat 7.0.54中构建和运行我的应用程序,并直接在Tomcat的/ webapps文件夹中部署war。

但是当我在Jboss 7.1.1 Final中部署同样的战争时,它会给我以下错误。

10:43:45,390 WARN  [org.jboss.jaxrs] (MSC service thread 1-7) JBAS011204: resteasy.scan found and ignored in web.xml. This is not necessary, as Resteasy will use the container integration in the JAX-RS 1.1 specification in section 2.3.2
10:43:45,390 WARN  [org.jboss.jaxrs] (MSC service thread 1-7) JBAS011204: resteasy.scan.providers found and ignored in web.xml. This is not necessary, as Resteasy will use the container integration in the JAX-RS 1.1 specification in section 2.3.2
10:43:45,391 WARN  [org.jboss.jaxrs] (MSC service thread 1-7) JBAS011204: resteasy.scan.resources found and ignored in web.xml. This is not necessary, as Resteasy will use the container integration in the JAX-RS 1.1 specification in section 2.3.2
10:43:46,128 INFO  [com.sun.jersey.api.core.PackagesResourceConfig] (MSC service thread 1-2) Scanning for root resource and provider classes in the packages:
  com.xxx.xxx.xxx.xxx.impl
  org.codehaus.jackson.jaxrs
10:43:46,534 INFO  [com.sun.jersey.server.impl.application.WebApplicationImpl] (MSC service thread 1-2) Initiating Jersey application, version 'Jersey: ${project.version} ${buildNumber}'
10:43:47,372 SEVERE [com.sun.jersey.server.impl.application.RootResourceUriRules] (MSC service thread 1-2) The ResourceConfig instance does not contain any root resource classes.
10:43:47,373 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/xxxxxx]] (MSC service thread 1-2) StandardWrapper.Throwable: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
    at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1359) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) [jersey-core-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491) [jersey-servlet-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321) [jersey-servlet-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) [jersey-servlet-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207) [jersey-servlet-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376) [jersey-servlet-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559) [jersey-servlet-1.18.1.jar:1.18.1]
    at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_60]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_60]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_60]

10:43:47,388 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/taxation]] (MSC service thread 1-2) Servlet /xxxxxxx threw load() exception: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
    at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1359) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) [jersey-core-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790) [jersey-server-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491) [jersey-servlet-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321) [jersey-servlet-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) [jersey-servlet-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207) [jersey-servlet-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376) [jersey-servlet-1.18.1.jar:1.18.1]
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559) [jersey-servlet-1.18.1.jar:1.18.1]
    at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_60]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_60]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_60]

此外,当我将这个战争解压缩到一个文件夹并在Jboss中部署该文件夹时,它可以工作!如果我直接从Eclipse在Jboss中运行我的项目,它也可以工作。但是,如果我将项目导出为战争(来自eclipse)并将该war文件部署到Jboss中,它又会给我同样的问题。

当我深入研究泽西岛的代码时,我发现com.sun.jersey.core.spi.scanning.uri.FileSchemeScanner无法从战争中挑选我的班级档案。

请帮助我们解决此问题。

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,并希望将其发布,以便其他人可以受益。我们的构建脚本存在问题。我们使用不同版本的Jersey库。对于某些库,正在使用版本1.18.1,而对于其他版本,正在使用版本1.18。

一旦所有库的版本更新为1.18.1,它就能完美运行。