jersey
  1. jersey
  2. JERSEY-1208

AsyncClient.trace forces Future.get() always throw an exception

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0-m05
    • Fix Version/s: 2.0
    • Component/s: core
    • Labels:
      None

      Description

      Whatever AsyncInvoker.trace() methods is used, the same exception is thrown on Future.get(). For instance:

      Client client = ClientFactory.newClient();
      Target target = client.target(url());
      AsyncInvoker async = target.request().async();
      Entity<String> entity = Entity.entity("trace", MediaType.WILDCARD_TYPE);
      Future<Response> future = async.trace(entity);
      future.get()
      

      throws

       06-13-2012 08:22:41:  ERROR: Exception at:
       06-13-2012 08:22:41:  ERROR: java.util.concurrent.ExecutionException: InvocationException{message=java.net.ProtocolException: HTTP me
      't support output, response=null}
              at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:289)
              at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:276)
              at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:111)
       Caused by: InvocationException{message=java.net.ProtocolException: HTTP method TRACE doesn't support output, response=null}
              at org.glassfish.jersey.client.JerseyClient$1$1.failure(JerseyClient.java:298)
              at org.glassfish.jersey.process.internal.ResponseProcessor.notifyCallback(ResponseProcessor.java:309)
              at org.glassfish.jersey.process.internal.ResponseProcessor.setResult(ResponseProcessor.java:296)
              at org.glassfish.jersey.process.internal.ResponseProcessor.access$400(ResponseProcessor.java:87)
              at org.glassfish.jersey.process.internal.ResponseProcessor$1.run(ResponseProcessor.java:211)
              at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:237)
              at org.glassfish.jersey.process.internal.ResponseProcessor.run(ResponseProcessor.java:184)
              at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
              at com.google.common.util.concurrent.ExecutionList$RunnableExecutorPair.execute(ExecutionList.java:149)
              at com.google.common.util.concurrent.ExecutionList.add(ExecutionList.java:105)
              at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:155)
              at org.glassfish.jersey.process.internal.RequestInvoker$2.run(RequestInvoker.java:189)
              at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:237)
              at org.glassfish.jersey.process.internal.RequestInvoker$3.run(RequestInvoker.java:199)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
              at java.util.concurrent.FutureTask.run(FutureTask.java:138)
              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:195)
              at org.glassfish.jersey.client.JerseyClient$1.call(JerseyClient.java:287)
              at org.glassfish.jersey.client.JerseyClient$1.call(JerseyClient.java:262)
              at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:364)
              at org.glassfish.jersey.client.JerseyClient.submit(JerseyClient.java:261)
              at org.glassfish.jersey.client.JerseyInvocation.submit(JerseyInvocation.java:580)
              at org.glassfish.jersey.client.JerseyInvocation$AsyncInvoker.method(JerseyInvocation.java:522)
              at org.glassfish.jersey.client.JerseyInvocation$AsyncInvoker.trace(JerseyInvocation.java:476)
              ... 12 more
       Caused by: java.lang.RuntimeException: java.net.ProtocolException: HTTP method TRACE doesn't support output
              at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:88)
              at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:72)
              at org.glassfish.jersey.process.internal.RequestInvoker$AcceptingInvoker.apply(RequestInvoker.java:241)
              at org.glassfish.jersey.process.internal.RequestInvoker$AcceptingInvoker.apply(RequestInvoker.java:217)
              at org.glassfish.jersey.process.internal.AsyncInflectorAdapter.apply(AsyncInflectorAdapter.java:121)
              at org.glassfish.jersey.process.internal.RequestInvoker$2.run(RequestInvoker.java:187)
              ... 29 more
       Caused by: java.net.ProtocolException: HTTP method TRACE doesn't support output
              at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1004)
              at org.glassfish.jersey.client.HttpUrlConnector$1$1.getOutputStream(HttpUrlConnector.java:153)
              at org.glassfish.jersey.internal.util.CommittingOutputStream.commitWrite(CommittingOutputStream.java:150)
              at org.glassfish.jersey.internal.util.CommittingOutputStream.write(CommittingOutputStream.java:120)
              at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
              at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
              at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:276)
              at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)
              at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212)
              at java.io.BufferedWriter.flush(BufferedWriter.java:236)
              at org.glassfish.jersey.message.internal.ReaderWriter.writeToAsString(ReaderWriter.java:189)
              at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvid
      
              at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:95)
              at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:56)
              at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorEx
      
              at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:156)
              at org.glassfish.jersey.message.internal.ExceptionWrapperInterceptor.aroundWriteTo(ExceptionWrapperInterceptor.java:77)
              at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:156)
              at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:632)
              at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:622)
              at org.glassfish.jersey.client.RequestWriter.writeRequestEntity(RequestWriter.java:261)
              at org.glassfish.jersey.client.HttpUrlConnector._apply(HttpUrlConnector.java:125)
              at org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:86)
              ... 34 more
      

      But in this case, for trace, I would never get a response to check the status code.

        Activity

        Hide
        Michal Gajdos added a comment -

        Will be fixed as a part of JAX_RS_SPEC-212.
        Created issue JERSEY-1376 to ensure that input parameters of AsyncInvoker#method and SyncInvoker#method are valid.

        Show
        Michal Gajdos added a comment - Will be fixed as a part of JAX_RS_SPEC-212 . Created issue JERSEY-1376 to ensure that input parameters of AsyncInvoker#method and SyncInvoker#method are valid.

          People

          • Assignee:
            Michal Gajdos
            Reporter:
            jan.supol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 6 hours
              6h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 3 hours, 1 minute Time Not Required
              3h 1m