Jersey : The ResourceConfig instance does not contain any root resource classes
Published: July 18, 2011 , Updated: July 18, 2011 , Author: mkyong
Problem
Deploying Jersey REST service, hit following error message on Tomcat.
SEVERE: Servlet /RESTfulExample threw load() exception com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes. //... code omitted
Here’s the web.xml
<web-app ...> <servlet> <servlet-name>jersey-serlvet</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.mkyong.rest</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jersey-serlvet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
Solution
Many reasons causing this “ResourceConfig” error message. Few solutions that i know :
- com.sun.jersey.config.property.packages doesn’t exist in your
web.xml. - com.sun.jersey.config.property.packages included a resource that doesn’t include any jersey services. In above case,
"com.mkyong.rest” doesn’t contains any jersey services.
Note : You can find more similar articles at - JAX-RS Tutorials







i have the same probleme , i hava my ejb appl and my web app , in the EJB project i have the session wich i translate them on a REST using JERSEY ,
here i am “The ResourceConfig instance does not contain any root resource classes.”
did you find a solution ?
sorry, i think in my above post I have not provide the java and web.xml code properly.
here is the my EJB3.0 session bean which I have converted to Rest Service:
here is my web.xml:
Hi MK,
Thanks for your Post.
I am also facing the same problem when I convert the EJB3.0 session bean into ReST service.
my session bean:
package com.dfs.ejb.rest.demo;
import javax.ejb.Stateless;
import javax.ws.rs.*;
/**
* Session Bean implementation class NameService
*/
@Path(“name”)
@Stateless
public class NameService implements NameServiceRemote {
/**
* Default constructor.
*/
public NameService() {
// TODO Auto-generated constructor stub
}
@GET
@Produces(“text/html”)
public String getHtml() {
return “Hello Rajesh”;
}
@PUT
@Consumes(“text/plain”)
public void put(String content) {
System.out.println(“Inside put :”+content);
}
}
my web.xml:
Jersey REST Service
com.sun.jersey.spi.container.servlet.ServletContainer
com.sun.jersey.config.property.packages
com.dfs.ejb.rest.demo
1
Jersey REST Service
/rest/*
if I add the ejb project as a jar inside lib of my web project its working fine, but If I add the ejb project as J2ee module dependency to web project its working…
Could you please let me know the process of Converting EJB3 session bean into ReST service.
Thanks in Advance!
Rajesh V