atom feed5 messages in net.java.dev.jersey.usersRE: The ResourceConfig instance does ...
FromSent OnAttachments
Dan LoweMar 17, 2008 6:52 am 
Paul SandozMar 17, 2008 7:05 am 
Dan LoweMar 17, 2008 7:21 am 
Paul SandozMar 17, 2008 8:13 am 
Dan LoweMar 19, 2008 10:40 am 
Subject:RE: The ResourceConfig instance does not contain any root resource classes.
From:Dan Lowe (da@gc1.com)
Date:Mar 19, 2008 10:40:32 am
List:net.java.dev.jersey.users

Thanks Paul,

That work around did the trick.

-----Original Message----- From: Paul@Sun.COM [mailto:Paul@Sun.COM] Sent: Monday, March 17, 2008 11:13 AM To: use@jersey.dev.java.net Subject: Re: The ResourceConfig instance does not contain any root resource classes.

Dan Lowe wrote:

Thanks for getting back so quick. It wasn't the space, I removed it and still got the same error so I guess it must be how resin looks for the files.

Drat.

By the way, my class is located in the WEB-INF/classes directory if that helps.

That works OK for Tomcat, GF and Jetty.

Can you send the complete log output when you try to deploy?

Would it be possible to package up and send the complete example with some simple instructions on how to deploy using resin?

The work around is to specify your own implementation of ResourceConfig that specifies your root resource classes.

public class MyResourceConfig extends DefaultResourceConfig { public MyResourceConfig() { super(com.gc.webservices.TestRestResource.class); } }

<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><...>.MyResourceConfig</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet>

Dan Lowe

-----Original Message----- From: Paul@Sun.COM [mailto:Paul@Sun.COM] Sent: Monday, March 17, 2008 10:06 AM To: use@jersey.dev.java.net Subject: Re: The ResourceConfig instance does not contain any root resource classes.

Dan Lowe wrote:

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:

I have not used the resin server so there may be issues with that as we have found inconsistencies between scanning techniques on different web containers. But see below... it looks like you have a additional space character for the package name.

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>

^ | Is that a space character?

What happens if you delete the space character?

If that solves things it is a bug in Jersey, it should call String.trim(). Plus we should have logging for packages that are not found.

Paul.

</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**