[MGNLRESTCL-28] Module doesn't work with resteasy-client 3.1.3 Created: 29/Sep/17  Updated: 13/Oct/17  Resolved: 11/Oct/17

Status: Closed
Project: REST Client
Component/s: None
Affects Version/s: None
Fix Version/s: 1.5

Type: Task Priority: Blocker
Reporter: Milan Divilek Assignee: Philip Mundt
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
caused by MGNLREST-90 Prepare rest major and upgrade libraries Closed
duplicate
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Release notes required:
Yes
Documentation update required:
Yes
Sprint: Basel 117
Story Points: 3

 Description   

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.


Generated at Mon Feb 12 10:42:29 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.