在Jboss 7.1.1 Final上部署后,Jersey 1.18.1无法选择我的静态服务 [英] Jersey 1.18.1 is unable to pick my restful service when deployed on Jboss 7.1.1 final

查看:236
本文介绍了在Jboss 7.1.1 Final上部署后,Jersey 1.18.1无法选择我的静态服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a very confusing problem with me. I have a eclipse Restful service project which is being built by gradle. I can successfully build and run my application in Tomcat 7.0.54, from within Eclipse and by deploying the war directly in /webapps folder of Tomcat.

但是当我在Jboss 7.1.1 Final中部署相同的战争时,它给了我下面的错误.

But when I deploy my same war in Jboss 7.1.1 Final, it gives me below error.

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中导出)并将该战争文件部署到Jboss中,它将再次给我带来同样的问题.

Moreover, when I unpack this war to a folder and deploy that folder inside Jboss, it works! It also works if I run my project in Jboss directly from Eclipse. However, if I export the project as a war (from eclipse) and deploy that war file into Jboss, it again gives me same problem.

当我深入到Jersey的代码时,我发现com.sun.jersey.core.spi.scanning.uri.FileSchemeScanner无法从战争中挑选我的班级文件.

When I drilled down into the the code of Jersey, I found that com.sun.jersey.core.spi.scanning.uri.FileSchemeScanner is not able to pick my class files from the war.

请帮助我们解决此问题.

Please help us resolve this issue.

推荐答案

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

I found the solution, and would like to post it so someone else could benefit. The problem was there in our build script. We were using different version of Jersey libraries. For some of the libraries, version 1.18.1 was being used, while for some other version 1.18 was being used.

所有库的版本均更新为1.18.1后,便可以完美运行.

Once the version for all the libraries was updated to 1.18.1, it worked perfectly.

这篇关于在Jboss 7.1.1 Final上部署后,Jersey 1.18.1无法选择我的静态服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆