java.lang.ClassCastException: org.glassfish.jersey.uri.internal.JerseyUriBuilder cannot be cast to org.jboss.resteasy.specimpl.ResteasyUriBuilder

GitHub | lordofthejars | 3 years ago
  1. 0

    ClassCastException is thrown if Jersey is used.

    GitHub | 3 years ago | lordofthejars
    java.lang.ClassCastException: org.glassfish.jersey.uri.internal.JerseyUriBuilder cannot be cast to org.jboss.resteasy.specimpl.ResteasyUriBuilder
  2. 0

    You must use at least one, but no more than one http method annotation on for reaseasy proxy client

    Stack Overflow | 2 years ago | user3369719
    java.lang.RuntimeException: You must use at least one, but no more than one http method annotation on: public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Resteasy v.3 client does not allow to read the entity if an exception was thrown in the method that returns void. {code}@Path("test") public interface IService { @POST @Path("test") public void test() throws Exception; } public class Service implements IService { @Override public void test() throws Exception { throw new Exception("Blah"); } } @Provider public class ServerExceptionHandler implements ExceptionMapper<Exception> { public Response toResponse(Exception exception) { return Response.serverError().entity("Blah blah blah").build(); } } {code} This code (v.2 client) works fine. {code}IService service = ProxyFactory.create(IService.class, "http://localhost:8080/resteasy-test/test"); try { service.test(); } catch (ClientResponseFailure e) { Response resp = e.getResponse(); System.out.println(((ClientResponse) resp).getEntity(String.class)); }{code} But that code (v.3 client) fails. {code}ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = (ResteasyWebTarget) client.target("http://localhost:8080/resteasy-test/test"); IService service = target.proxy(IService.class); try { service.test(); } catch (InternalServerErrorException e) { Response resp = e.getResponse(); System.out.println(resp.readEntity(String.class)); }{code} {code}Exception in thread "main" java.lang.IllegalStateException: Response is closed. at org.jboss.resteasy.specimpl.BuiltResponse.abortIfClosed(BuiltResponse.java:254) at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readEntity(ClientResponse.java:148) at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:217){code} The response's entity is buffered in the DefaultEntityExtractorFactory.createVoidExtractor. However ClientResponse cannot read the entity (even from the buffer) if it was closed.

    JBoss Issue Tracker | 3 years ago | Vlad Arkhipov
    java.lang.IllegalStateException: Response is closed.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.glassfish.jersey.uri.internal.JerseyUriBuilder cannot be cast to org.jboss.resteasy.specimpl.ResteasyUriBuilder

      at org.jboss.resteasy.client.jaxrs.internal.ClientWebTarget.queryParamNoTemplate()
    2. RESTEasy JAX-RS Client
      QueryParamProcessor.apply
      1. org.jboss.resteasy.client.jaxrs.internal.ClientWebTarget.queryParamNoTemplate(ClientWebTarget.java:287)
      2. org.jboss.resteasy.client.jaxrs.internal.proxy.processors.webtarget.QueryParamProcessor.apply(QueryParamProcessor.java:23)
      3. org.jboss.resteasy.client.jaxrs.internal.proxy.processors.webtarget.QueryParamProcessor.apply(QueryParamProcessor.java:12)
      3 frames