Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-383

Provider class seen as resource class during scanning

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.0-beta-3
    • 2.0-beta-2
    • jaxrs
    • None
    • Compatibility/Configuration

    Description

      I deploy a .war file without a web.xml and without specifying an Application class. The war file contains both resource classes and provider classes. The war file deploys fine using Jersey on Glassfish.

      On JBoss 6M2 with its built-in RestEasy provider, deployment fails because RestEasy complains that my provider class is not a valid resource class. Indeed it is not, since it is not a resource class at all.

      Here is what my provider class looks like:

      @Provider
      public class Resolver implements ContextResolver<Class> {

      @Override
      public Class getContext(final Class<?> type)

      { // content snipped for brevity }

      }

      RestEasy claims that this is not a valid resource class because it lacks a path.

      Here are the contents of server.log that are relevant. "GorpResource" is annotated as a resource with a @Path annotation. "Resolver" is only annotated with @Provider, because it is not a resource, and shouldn't be interpreted as one:

      2010-04-28 17:35:04,187 INFO [org.jboss.bootstrap.impl.base.server.AbstractServer] (Thread-2) JBossAS [6.0.0.20100216-M2 (build: SVNTag=JBoss_6_0_0_20100216-M2 date=20100216)] Started in 1m:609ms

      2010-04-28 17:35:29,843 INFO [org.jboss.resteasy.integration.deployers.ResteasyIntegrationDeployer] (HDScanner) ******** Adding RESOURCE CLASS: com.jenzabar.ngp.war.test.GorpResource

      2010-04-28 17:35:29,859 INFO [org.jboss.resteasy.integration.deployers.ResteasyIntegrationDeployer] (HDScanner) ******** Adding RESOURCE CLASS: com.jenzabar.ngp.smartgwt.jaxrs.RestDataSourceAdapter

      2010-04-28 17:35:29,859 INFO [org.jboss.resteasy.integration.deployers.ResteasyIntegrationDeployer] (HDScanner) ******** Adding RESOURCE CLASS: com.jenzabar.ngp.war.test.Resolver

      2010-04-28 17:35:30,953 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) deploy, ctxPath=/ngp-war-test-1.0-SNAPSHOT

      2010-04-28 17:35:31,312 INFO [org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap] (HDScanner) Adding scanned @Provider: com.jenzabar.ngp.war.test.Resolver

      2010-04-28 17:35:31,312 INFO [org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap] (HDScanner) Adding scanned @Provider: com.jenzabar.ngp.smartgwt.jaxrs.RestDataSourceAdapter

      2010-04-28 17:35:31,312 INFO [org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap] (HDScanner) Adding scanned resource: com.jenzabar.ngp.war.test.GorpResource

      2010-04-28 17:35:32,312 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/ngp-war-test-1.0-SNAPSHOT]] (HDScanner) Exception starting filter Resteasy: java.lang.RuntimeException: Class is not a root resource. It, or one of its interfaces must be annotated with @Path: com.jenzabar.ngp.smartgwt.jaxrs.RestDataSourceAdapter implements: javax.servlet.Filter javax.ws.rs.ext.MessageBodyWriter javax.ws.rs.ext.ContextResolver

      at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:104)

      at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:83)

      at org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:72)

      at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:225)

      at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:151)

      at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67)

      at org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.init(FilterDispatcher.java:39)

      Attachments

        Activity

          People

            patriot1burke@gmail.com Bill Burke (Inactive)
            ljnelson+github@gmail.com Laird Nelson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: