users@jersey.java.net

[Jersey] “The ResourceConfig instance does not contain any root resource classes” - when the resource classes are in a separate jar

From: daudiam <daudiam_at_yahoo.co.in>
Date: Mon, 13 Feb 2012 21:52:36 -0800 (PST)

The error has been discussed extensively but in my case, i*t doesn't appear
if the application class and resource class are packaged in the same war*.
In case the resource class is an ejb (annotated with @Stateless) and placed
in a separate jar, then the package containing the resource EJB is not
found. I am using* JBoss 6.1 Final and Jersey*. The following is my
application file (in the org.what package and deployed as a war) :

@ApplicationPath("information")
public class InformationApplication extends PackagesResourceConfig {
    public InformationApplication() {
        super("org.what.resources");
    }
}

The resource file is as follows (in the org.what.resources package and
deployed as a jar):

@Stateless
@Path("/biographical")
public class InformationResource {

    @GET
    @Produces("application/xml")
    public BiographicalInformation getBiographicalInfo(){

        BiographicalInformation info = new BiographicalInformation();
        info.setName("Hello");
        info.setJob("Web developer");
        info.setEducation("B.Tech");

        return info;
    }

}

The model class BiographicalInformation is also packaged in the jar
containing the resource class. I am not using any web.xml. The
application.xml file is :

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID"
version="6">
  <display-name>JerseyEar</display-name>
  <module>
    <ejb>Jersey2EJB.jar</ejb>
  </module>
  <module>
    <web>
      <web-uri>Jersey3.war</web-uri>
      <context-root>Jersey3</context-root>
    </web>
  </module>
</application>



--
View this message in context: http://jersey.576304.n2.nabble.com/The-ResourceConfig-instance-does-not-contain-any-root-resource-classes-when-the-resource-classes-arer-tp7282927p7282927.html
Sent from the Jersey mailing list archive at Nabble.com.