我在发布项目时遇到了一些问题。在JBoss 7.1中,它可以与WAS一起使用并直接通过Eclipse发布到JBoss,但是当通过部署文件夹中的.ear或通过控制台发布时JBoss我有错误" ResourceConfig实例不包含任何根资源类。"。
我已经针对此问题尝试了几种解决方案,但没有成功。我发现有可能解决它,但不知道如何。
Jersey 1.18.1 is unable to pick my restful service when deployed on Jboss 7.1.1 final
有人可以向我解释纠正此错误的步骤吗?
这是我在web.xml中的servlet定义
<servlet>
<servlet-name>Jersey Servlet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.xxxxx.webservices.rest</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
注意:当我评论它的标签时,阅读项目中的所有类,但这对我来说是不可接受的,我只需要阅读&#34; com.xxxxx.webservices.rest&#34; < / p>
这是我的错误:
12:24:24,562 INFO [com.sun.jersey.api.core.PackagesResourceConfig] (MSC service thread 1-4) Scanning for root resource and provider classes in the packages: com.xxxxx.webservices.rest 12:24:24,656 INFO [com.sun.jersey.server.impl.application.WebApplicationImpl] (MSC service thread 1-4) Initiating Jersey application, version 'Jersey: 1.18 11/22/2013 01:21 AM' 12:24:24,672 INFO [stdout] (Thread-68)
12:24:24,673 INFO [stdout] (Thread-68) No logging specified yet. Temporarily logging to webserver default file.
12:24:24,674 INFO [stdout] (Thread-68) [com.transactionservice.config.ConfigLoader - ] - filePath --> C:/jBoss/jboss-as-7.1.1.Final/standalone/xxxxx/xxxxx/config.properties
12:24:24,675 INFO [stdout] (Thread-68)
12:24:24,682 INFO [stdout] (Thread-68)
12:24:24,683 INFO [stdout] (Thread-68) No logging specified yet. Temporarily logging to webserver default file.
12:24:24,684 INFO [stdout] (Thread-68) [com.transactionservice.config.ConfigLoader - ] - filePath --> C:/jBoss/jboss-as-7.1.1.Final/standalone/xxxxx/xxxxx/config.properties
12:24:24,685 INFO [stdout] (Thread-68)
12:24:24,868 SEVERE [com.sun.jersey.server.impl.application.RootResourceUriRules] (MSC service thread 1-4) The ResourceConfig instance does not contain any root resource classes. 12:24:24,870 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/xxxxx]] (MSC service thread 1-4) 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.(RootResourceUriRules.java:99) [jersey-server-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1359) [jersey-server-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180) [jersey-server-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799) [jersey-server-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795) [jersey-server-1.18.jar:1.18] at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) [jersey-core-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795) [jersey-server-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790) [jersey-server-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491) [jersey-servlet-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321) [jersey-servlet-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) [jersey-servlet-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207) [jersey-servlet-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376) [jersey-servlet-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559) [jersey-servlet-1.18.jar:1.18] 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_67] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
12:24:24,894 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/xxxxx]] (MSC service thread 1-4) Servlet /xxxxx 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.(RootResourceUriRules.java:99) [jersey-server-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1359) [jersey-server-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:180) [jersey-server-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:799) [jersey-server-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:795) [jersey-server-1.18.jar:1.18] at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193) [jersey-core-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795) [jersey-server-1.18.jar:1.18] at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790) [jersey-server-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491) [jersey-servlet-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321) [jersey-servlet-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) [jersey-servlet-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207) [jersey-servlet-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376) [jersey-servlet-1.18.jar:1.18] at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559) [jersey-servlet-1.18.jar:1.18] 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_67] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67] at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]