Uploaded image for project: 'REST Client'
  1. REST Client
  2. MGNLRESTCL-28

Module doesn't work with resteasy-client 3.1.3

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 1.5
    • None
    • None
    • None
    • Yes
    • Yes
    • Basel 117
    • 3

      Rest module has updated reasteasy to 3.1.3 (already in BOM), but rest-client module can't work with this version because

      Caused by: java.lang.ClassNotFoundException: org.jboss.resteasy.client.core.ClientErrorInterceptor
      

      Details

      This new version of resteasy does not provide that class anymore. Additionally, classes org.jboss.resteasy.spi.ResteasyProviderFactory do not have the respective setters (#addClientErrorInterceptor(ClientErrorInterceptor)) anymore. There is a org.jboss.resteasy:resteasy-legacy package that provides the ClientErrorInterceptor class and a ResteasyProviderFactory (in package org.jboss.resteasy.spi.old) – however there is no possibility to get an instance of ResteasyProviderFactory. Casting does not work:

      Caused by: java.lang.ClassCastException: org.jboss.resteasy.core.ThreadLocalResteasyProviderFactory cannot be cast to org.jboss.resteasy.spi.old.ResteasyProviderFactory
      at info.magnolia.resteasy.client.factory.RestEasyClientFactory.createClient(RestEasyClientFactory.java:79) ~[magnolia-resteasy-client-2.0-SNAPSHOT.jar:?]
      at info.magnolia.cache.browser.rest.CacheServiceFactory.createCacheServices(CacheServiceFactory.java:89) ~[magnolia-cache-browser-app-5.6-SNAPSHOT.jar:?]
      at info.magnolia.cache.browser.app.CacheFormDialogPresenter.isValid(CacheFormDialogPresenter.java:94) ~[magnolia-cache-browser-app-5.6-SNAPSHOT.jar:?]
      at info.magnolia.cache.browser.app.action.LoginDialogAction.execute(LoginDialogAction.java:58) ~[magnolia-cache-browser-app-5.6-SNAPSHOT.jar:?]
      at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:62) ~[magnolia-ui-api-5.6-SNAPSHOT.jar:?]
      ... 104 more
      

      Solution

      We're suggesting the removal of ClientErrorInterceptor capabilities from our client implementation.

      Additional information

      From https://docs.jboss.org/resteasy/docs/resteasy-upgrade-guide-en-US.pdf#page=11:

      Resteasy 2 had two facilities for handling errors on the client side.

      An instance of an org.jboss.resteasy.client.core.ClientErrorInterceptor could be registered to handle exceptions thrown during a proxied call. Also, an instance of an org.jboss.resteasy.client.exception.mapper.ClientExceptionMapper could be registered to map exceptions thrown during a proxied call. A default ClientExceptionMapper was installed that mapped exceptions thrown by the HttpClient transport layer to Resteasy specific analogs. For example, an org.apache.http.client.ClientProtocolException would be mapped to an org.jboss.resteasy.client.exception.ResteasyClientProtocolException. These two facilities do not exist in Resteasy 3.

      Instead, the JAX-RS 2.0 specification mandates the use of javax.ws.rs.ProcessingException and javax.ws.rs.client.ResponseProcessingException. In particular, exceptions thrown while processing a request should be mapped to a ProcessingException, and exceptions thrown while processing a response should be mapped to a ResponseProcessingException.

        Acceptance criteria

              pmundt Philip Mundt
              mdivilek Milan Divilek
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoR