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</servlet-class>
>
>
>
> <init-param>
>
>
> <param-name>com.sun.ws.rest.config.property.resourceConfigClass</param-name>
>
>
>
> <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(WebApplicationImpl.java:404)
>
> [17:33:02.600] at
> com.sun.ws.rest.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:329)
>
> [17:33:02.600] at
> com.sun.ws.rest.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:277)
>
> [17:33:02.600] at
> com.sun.ws.rest.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:333)
>
> [17:33:02.600] at
> com.sun.ws.rest.spi.container.servlet.ServletContainer.init(ServletContainer.java:110)
>
> [17:33:02.600] at
> com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConfigImpl.java:646)
>
> [17:33:02.600] at
> com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.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(StartAutoRedeployAutoStrategy.java:72)
>
> [17:33:02.600] at
> com.caucho.server.deploy.DeployController.startOnInit(DeployController.java: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.java: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(StartAutoRedeployAutoStrategy.java:72)
>
> [17:33:02.600] at
> com.caucho.server.deploy.DeployController.startOnInit(DeployController.java: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(AbstractDeployControllerStrategy.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**
>
>
>
>
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109