jersey
  1. jersey
  2. JERSEY-1634

Auto-scannning of WAR not working for default Application class

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-rc1, 2.0
    • Component/s: None
    • Labels:
      None

      Description

      If Application class is like:

      @ApplicationPath("webresources")
      public class MyApplication extends Application {

      @Override
      public Set<Class<?>> getClasses()

      { Set<Class<?>> resources = new java.util.HashSet<>(); resources.add(org.sample.client.MyResource.class); return resources; }

      }

      then the resource is accessible at the defined path. But without overriding getClasses() method, Jersey throws the following exception:

      javax.ws.rs.NotFoundException
      at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:853)
      at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:728)
      at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:86)
      at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:629)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:420)
      at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:625)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:360)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:260)

      Default implementation of Application should trigger auto-scanning of resources in the WAR.

        Activity

        Hide
        gmazza added a comment - - edited

        Are you sure? The Application class is defined in the JAX-RS specification, so if no autoscanning is defined there then I would guess Jersey shouldn't autoscan for resources. For portability, the sum of resources (root resources and providers) that a given Application subclass makes available should be the same regardless of the JAX-RS implementation it runs on.

        Show
        gmazza added a comment - - edited Are you sure? The Application class is defined in the JAX-RS specification, so if no autoscanning is defined there then I would guess Jersey shouldn't autoscan for resources. For portability, the sum of resources (root resources and providers) that a given Application subclass makes available should be the same regardless of the JAX-RS implementation it runs on.
        Hide
        Michal Gajdos added a comment -

        Fixed as a part of JERSEY-1595.

        Show
        Michal Gajdos added a comment - Fixed as a part of JERSEY-1595 .

          People

          • Assignee:
            Michal Gajdos
            Reporter:
            arungupta
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 hours
              3h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 30 minutes Time Not Required
              30m