jersey
  1. jersey
  2. JERSEY-1536

{Sync,Async}Invoker#{post, put, ...}(...,GenericType<Response>) throws an exception

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.0-m09
    • Fix Version/s: 2.0-rc1, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      GenericType<Response> generic = new GenericType<Response>(Response.class);
      Entity entity = Entity.entity("entity", MediaType.WILDCARD_TYPE);
      
      Client client = ClientFactory.newClient();
      WebTarget target = client.target(getUrl(methodName));
      SyncInvoker sync = target.request();
      Response response = sync.post(entity, generic);
      

      throws

      javax.ws.rs.client.ClientException: Unexpected error during response processing.
      at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:735)
      at org.glassfish.jersey.client.JerseyInvocation.access$600(JerseyInvocation.java:85)
      at org.glassfish.jersey.client.JerseyInvocation$3.call(JerseyInvocation.java:619)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:420)
      at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:615)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:384)
      at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:293)
      Caused by: org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyReader not found for media type=text/html, type=class javax.ws.rs.core.Response, genericType=class javax.ws.rs.core.Response.
      at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$TerminalReaderInterceptor.aroundReadFrom(ReaderInterceptorExecutor.java:198)
      at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:158)
      at org.glassfish.jersey.message.internal.ExceptionWrapperInterceptor.aroundReadFrom(ExceptionWrapperInterceptor.java:70)
      at org.glassfish.jersey.message.internal.ReaderInterceptorExecutor.proceed(ReaderInterceptorExecutor.java:158)
      at org.glassfish.jersey.message.internal.MessageBodyFactory.readFrom(MessageBodyFactory.java:807)
      at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:863)
      at org.glassfish.jersey.message.internal.InboundMessageContext.readEntity(InboundMessageContext.java:835)
      at org.glassfish.jersey.client.InboundJaxrsResponse.readEntity(InboundJaxrsResponse.java:100)
      at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:729)

      But Response is valid type as javadoc says:

      Throws WebApplicationException - in case the response status code of the response returned by the server is not successful and the specified generic response type does not represent Response.

      Note that it Works the same for SyncInvoker and AsyncInvoker, for all possible methods. It worked in some older version (2.0-m07?).

        Activity

        Hide
        Miroslav Fuksa added a comment -

        cannot reproduce. I have written tests for SYNC and ASYNC for GET and POST and it pass. I will add tests to jersey and close this issue.

        Show
        Miroslav Fuksa added a comment - cannot reproduce. I have written tests for SYNC and ASYNC for GET and POST and it pass. I will add tests to jersey and close this issue.
        Hide
        Miroslav Fuksa added a comment -

        cannot reproduce. Probably the issue has already been fixed. I have added tests to jersey.

        Show
        Miroslav Fuksa added a comment - cannot reproduce. Probably the issue has already been fixed. I have added tests to jersey.

          People

          • Assignee:
            Miroslav Fuksa
            Reporter:
            jan.supol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 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 - 1 hour Time Not Required
              1h