users@jersey.java.net

The ResourceConfig instance does not contain any root resource classes.

From: Dan Lowe <dan_at_gc1.com>
Date: Mon, 17 Mar 2008 09:52:42 -0400 (EDT)

Hi, I am just trying to get a basic example working but keep getting

"The ResourceConfig instance does not contain any root resource classes."
When

the app server attempts to deploy.

I am running my example on a resin server v3.0.25 using java 1.5 and
jersey 0.6:

 

Here is the code/web config I am trying to run.

 

Web.xml

<servlet>

        <servlet-name>Jersey</servlet-name>

 
<servlet-class>com.sun.ws.rest.impl.container.servlet.ServletContainer</se
rvlet-class>

        

        <init-param>

 
<param-name>com.sun.ws.rest.config.property.resourceConfigClass</param-nam
e>

 
<param-value>com.sun.ws.rest.api.core.PackagesResourceConfig</param-value>


        </init-param>

        <init-param>

 
<param-name>com.sun.ws.rest.config.property.packages</param-name>

            <param-value>com.gc.webservices </param-value>

        </init-param>

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

</servlet>

 

<servlet-mapping>

        <servlet-name>Jersey</servlet-name>

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

</servlet-mapping>

 

 

 

TestRestResource.java

package com.gc.webservices;

import javax.ws.rs.core.HttpContext;

import javax.ws.rs.core.UriInfo;

import javax.ws.rs.ProduceMime;

import javax.ws.rs.Path;

import javax.ws.rs.GET;

 

@Path("resource")

public class TestRestResource{

 

@HttpContext

private UriInfo context;

 

@GET

@ProduceMime("text/plain")

public String getXml(){

return "Hello World";

}

}

 

 

When I deploy this I get:

[17:33:02.600] WARNING com.caucho.server.webapp.Application
com.sun.ws.rest.api.container.ContainerException: The ResourceConfig
instance does not contain any root resource classes.

[17:33:02.600] at
com.sun.ws.rest.impl.application.WebApplicationImpl.processRootResources(W
ebApplicationImpl.java:404)

[17:33:02.600] at
com.sun.ws.rest.impl.application.WebApplicationImpl.initiate(WebApplicatio
nImpl.java:329)

[17:33:02.600] at
com.sun.ws.rest.impl.application.WebApplicationImpl.initiate(WebApplicatio
nImpl.java:277)

[17:33:02.600] at
com.sun.ws.rest.spi.container.servlet.ServletContainer.initiate(ServletCon
tainer.java:333)

[17:33:02.600] at
com.sun.ws.rest.spi.container.servlet.ServletContainer.init(ServletContain
er.java:110)

[17:33:02.600] at
com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConf
igImpl.java:646)

[17:33:02.600] at
com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigIm
pl.java:587)

[17:33:02.600] at
com.caucho.server.dispatch.ServletManager.init(ServletManager.java:154)

[17:33:02.600] at
com.caucho.server.webapp.Application.start(Application.java:1654)

[17:33:02.600] at
com.caucho.server.deploy.DeployController.startImpl(DeployController.java:
621)

[17:33:02.600] at
com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(StartAu
toRedeployAutoStrategy.java:72)

[17:33:02.600] at
com.caucho.server.deploy.DeployController.startOnInit(DeployController.jav
a:509)

[17:33:02.600] at
com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:153)

[17:33:02.600] at
com.caucho.server.webapp.ApplicationContainer.start(ApplicationContainer.j
ava:670)

[17:33:02.600] at com.caucho.server.host.Host.start(Host.java:420)

[17:33:02.600] at
com.caucho.server.deploy.DeployController.startImpl(DeployController.java:
621)

[17:33:02.600] at
com.caucho.server.deploy.StartAutoRedeployAutoStrategy.startOnInit(StartAu
toRedeployAutoStrategy.java:72)

[17:33:02.600] at
com.caucho.server.deploy.DeployController.startOnInit(DeployController.jav
a:509)

[17:33:02.600] at
com.caucho.server.deploy.DeployContainer.start(DeployContainer.java:153)

[17:33:02.600] at
com.caucho.server.host.HostContainer.start(HostContainer.java:504)

[17:33:02.600] at
com.caucho.server.resin.ServletServer.start(ServletServer.java:971)

[17:33:02.600] at
com.caucho.server.deploy.DeployController.startImpl(DeployController.java:
621)

[17:33:02.600] at
com.caucho.server.deploy.AbstractDeployControllerStrategy.start(AbstractDe
ployControllerStrategy.java:56)

[17:33:02.600] at
com.caucho.server.deploy.DeployController.start(DeployController.java:517)

[17:33:02.600] at
com.caucho.server.resin.ResinServer.start(ResinServer.java:551)

[17:33:02.600] at com.caucho.server.resin.Resin.init(Resin.java)

[17:33:02.600] at com.caucho.server.resin.Resin.main(Resin.java:625)

 

 

Thanks,

Dan Lowe