jersey
  1. jersey
  2. JERSEY-1402

Relative URI are not working for WebTarget injection

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Works as designed
    • Affects Version/s: None
    • Fix Version/s: 2.0-m09, 2.0
    • Component/s: None
    • Labels:
      None

      Description

      Injecting a WebTarget in another JAX-RS resource as:

      @Path("myresource2")
      public class MyResource2 {
      public static final String RESOURCE_ENDPOINT = "/Jersey2Sample/webresources/myresource";

      @Uri(RESOURCE_ENDPOINT)
      WebTarget resource;

      @GET
      public String get()

      { return resource.request().get(String.class) + "2"; }

      When this resource is accessed using GET, then the following exception is thrown:

      SEVERE: InvocationException

      {message=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2, response=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2}
      org.glassfish.jersey.internal.MappableException: InvocationException{message=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2, response=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2}

      at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:122)
      at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(AbstractJavaResourceMethodDispatcherProvider.java:219)
      at org.glassfish.jersey.server.model.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:262)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:82)
      at org.glassfish.jersey.process.internal.RequestInvoker$AcceptingInvoker.apply(RequestInvoker.java:241)
      at org.glassfish.jersey.process.internal.AsyncInflectorAdapter.apply(AsyncInflectorAdapter.java:156)
      at org.glassfish.jersey.process.internal.RequestInvoker$2.run(RequestInvoker.java:188)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:283)
      at org.glassfish.jersey.process.internal.RequestInvoker$3.run(RequestInvoker.java:201)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
      at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:44)
      at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:41)
      at org.glassfish.jersey.process.internal.RequestInvoker.apply(RequestInvoker.java:197)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:752)
      at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:309)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:346)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:312)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:195)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1593)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:285)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:660)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:600)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:337)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:240)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:172)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:164)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:175)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:265)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:134)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:78)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:815)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:567)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:547)
      at java.lang.Thread.run(Thread.java:722)
      Caused by: InvocationException

      {message=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2, response=org.glassfish.jersey.client.InboundJaxrsResponse@50506ea2}

      at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:682)
      at org.glassfish.jersey.client.JerseyInvocation.access$400(JerseyInvocation.java:72)
      at org.glassfish.jersey.client.JerseyInvocation$2.completed(JerseyInvocation.java:605)
      at org.glassfish.jersey.client.JerseyInvocation$2.completed(JerseyInvocation.java:587)
      at org.glassfish.jersey.client.ClientConfig$State$4$1.result(ClientConfig.java:410)
      at org.glassfish.jersey.client.ClientConfig$State$4$1.result(ClientConfig.java:405)
      at org.glassfish.jersey.process.internal.ResponseProcessor.notifyCallback(ResponseProcessor.java:315)
      at org.glassfish.jersey.process.internal.ResponseProcessor.setResult(ResponseProcessor.java:301)
      at org.glassfish.jersey.process.internal.ResponseProcessor.access$600(ResponseProcessor.java:83)
      at org.glassfish.jersey.process.internal.ResponseProcessor$1.run(ResponseProcessor.java:243)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:283)
      at org.glassfish.jersey.process.internal.ResponseProcessor.run(ResponseProcessor.java:188)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      ... 1 more

      Changing the RESOURCE_ENDPOINT to an absolute URL returns the appropriate response. Changing the value to "myresource" works fine too.

      Filing a bug as mentioned on the users list at: http://java.net/projects/jersey/lists/users/archive/2012-08/message/128

        Activity

        arungupta created issue -
        Marek Potociar made changes -
        Field Original Value New Value
        Fix Version/s 2.0 [ 15271 ]
        Fix Version/s 2.0-unplanned [ 15288 ]
        Pavel Bucek made changes -
        Fix Version/s 2.0-m08 [ 16006 ]
        Fix Version/s 2.0-unplanned [ 15288 ]
        Marek Potociar made changes -
        Original Estimate 3 hours [ 10800 ]
        Remaining Estimate 3 hours [ 10800 ]
        Marek Potociar made changes -
        Fix Version/s 2.0-m09 [ 16050 ]
        Fix Version/s 2.0-m08 [ 16006 ]
        Pavel Bucek made changes -
        Assignee Pavel Bucek [ pavel_bucek ]
        Pavel Bucek made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Pavel Bucek made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Works as designed [ 7 ]
        Marek Potociar made changes -
        Original Estimate 3 hours [ 10800 ] 0 minutes [ 0 ]
        Remaining Estimate 3 hours [ 10800 ] 0 minutes [ 0 ]

          People

          • Assignee:
            Pavel Bucek
            Reporter:
            arungupta
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: