Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-1349

JAX-RS sub resources broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 7.0.1.Final
    • 7.0.0.Final
    • Web Services
    • None
    • Release Notes

      Having a root resource class

      @Path("person")
      public class PeopleResource {

      @Path("

      {name}

      ")
      public PersonResource findPerson(@PathParam("name") String name)

      { return new PersonResource(name); }

      }

      and a sub resource class

      public class PersonResource {

      private String name;

      public PersonResource(String name)

      { this.name = name; }

      @GET
      public String getName()

      { return name; }

      @GET
      @Path("/address")
      public String getClassName()

      { return name + "'s address is unknown."; }

      }

      The application fails with the following exception. Seems like during scanning the subresource is identified as a root resource (although it is not a root resource). Subsequently, RESTEasy's validation fails.

      javax.servlet.ServletException: Servlet.init() for servlet org.jboss.resteasy.cdi.test.MyApplication threw exception
      org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
      java.lang.Thread.run(Thread.java:662)

      root cause

      java.lang.RuntimeException: Class is not a root resource. It, or one of its interfaces must be annotated with @Path: org.jboss.resteasy.cdi.test.Subresource implements: java.io.Serializable
      org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:104)
      org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:83)
      org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:72)
      org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:367)
      org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:225)
      org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67)
      org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
      org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
      java.lang.Thread.run(Thread.java:662)

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              rhn-engineering-jharting Jozef Hartinger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: