2 Replies Latest reply on Dec 3, 2014 6:53 AM by Hari Kumar

    Unable to deploy application war in jboss-eap-6.1 when jersey is used

    Hari Kumar Newbie

      Hi All,

       

      In my application we are exposing some jersey rest services. If I deploy the application from eclipse, the server is started and application gets deployed successfully. But if we create a war for my project and deploy the war in jboss, it is throwing below error coz of jersey. Surprisingly, If the same war is unzipped and deployed in jboss, it works perfectly fine.

      Below is the error.

      11:49:39,930 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/interact-edge]] (ServerService Thread Pool -- 151) JBWEB000289: Servlet Jersey REST Service 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.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]

      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1194) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1100) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3591) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3798) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

      at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

      at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

      at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_21]

      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_21]

      at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_21]

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_21]

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_21]

      at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_21]

      at org.jboss.threads.JBossThread.run(JBossThread.java:122)

       

      Web.xml

      <!-- added for REST Service -->

        <servlet>

        <servlet-name>Jersey REST Service</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.test.company</param-value>

        </init-param>

        <init-param>

        <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>

        <param-value>true</param-value>

        </init-param>

        <load-on-startup>1</load-on-startup>

        </servlet>

        <context-param>

        <param-name>resteasy.scan</param-name>

        <param-value>false</param-value>

        </context-param>

        <context-param>

        <param-name>resteasy.scan.providers</param-name>

        <param-value>false</param-value>

        </context-param>

        <context-param>

        <param-name>resteasy.scan.resources</param-name>

        <param-value>false</param-value>

        </context-param>

        <servlet-mapping>

        <servlet-name>Jersey REST Service</servlet-name>

        <url-pattern>/rest/*</url-pattern>

        </servlet-mapping>

       

      I have tried without the  resteasy.scan. context params in web.xml.

       

      Please suggest a solution.