users@jersey.java.net

The ResourceConfig instance does not contain any root resource classes.

From: Davis Ford <davisford_at_gmail.com>
Date: Wed, 19 Nov 2008 12:41:11 -0500

I know this topic has been discussed on the list extensively. I have
tried to read all the posts and suggestions, and none of the proposed
solutions seem to work for me.

Dev Platform: Windows XP, JDK 6u10, Eclipse 3.3, Maven 2.0.9 using
jetty-maven-plugin, tomcat-maven-plugin.

If I run either:

mvn jetty:run-war

or

mvn tomcat:run-war

I encounter no issues.

However, if I run:

mvn jetty:run

or

mvn tomcat:run

I keep hitting this:

com.sun.jersey.api.container.ContainerException: The ResourceConfig
instance does not contain any root resource classes.
        at com.sun.jersey.impl.application.WebApplicationImpl.processRootResources(WebApplicationImpl.java:765)

I tried this (where com.my.package has the Java class that is
annotated with @Path)

<servlet>
                <servlet-name>ServletAdaptor</servlet-name>
                <servlet-class>com.sun.jersey.spi.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.my.package</param-value>
                </init-param>

Alternatively I tried this:

package com.my.package;
public class MyResourceConfig extends DefaultResourceConfig {
        public MyResourceConfig() {
                super(com.my.package.MyServlet.class);
        }
}

and then modified web.xml as such ->

<servlet>
                <servlet-name>ServletAdaptor</servlet-name>
                <servlet-class>com.sun.jersey.spi.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.my.package.MyResourceConfig</param-value>
                </init-param>

I still hit the same exception. Any ideas what I might be missing?

Thanks in advance!

Regards,
Davis