RestEasy library inconsistency
See original GitHub issueDescribe the bug
KC 15 & KC16 contain in the main pom.xml the dependency for the rest client
<resteasy.version>3.15.1.Final</resteasy.version>
<resteasy.undertow.version>${resteasy.version}</resteasy.undertow.version>
The problem is that, under KC 16.1.0 on containers with the Wildfly server, we found out that the related execution version from the server is
<resteasy.version>4.5.9.Final</resteasy.version>
Version
16.1.0
Expected behavior
The pom.xml should be updated to
<resteasy.version>4.5.9.Final</resteasy.version>
Actual behavior
There is API inconsistency while extending the project. This concept affects KC16 upgrade with custom libraries. We needed to rewrite the resteasy library dependency, which it can drive to future update-problems.
How to Reproduce?
Generate a custom module and introduce the following code:
(Resteasy v3.x)
HttpServletResponse contextData = ResteasyProviderFactory.getContextData(HttpServletResponse.class);
(Solved with resteasy v4.x)
HttpServletResponse contextData = ResteasyProviderFactoryImpl.getInstance().getContextData(HttpServletResponse.class); ResteasyProviderFactory
You will have an execution error on a KC16 wildfly server when the module is called, with the following stacktrace:
09:09:44,695 ERROR [org.keycloak.events.EventBuilder] (default task-26) Failed to send type to com.custom.keycloak.providers.events.MyErrorClass@647f9648: java.lang.IncompatibleClassChangeError: Expected static method 'java.lang.Object org.jboss.resteasy.spi.ResteasyProviderFactory.getContextData(java.lang.Class)'
...
at org.keycloak.keycloak-server-spi-private@16.1.0//org.keycloak.events.EventBuilder.send(EventBuilder.java:229)
at org.keycloak.keycloak-server-spi-private@16.1.0//org.keycloak.events.EventBuilder.success(EventBuilder.java:192)
at org.keycloak.keycloak-services@16.1.0//org.keycloak.services.managers.AuthenticationManager.finishedRequiredActions(AuthenticationManager.java:1031)
at org.keycloak.keycloak-services@16.1.0//org.keycloak.authentication.AuthenticationProcessor.authenticationComplete(AuthenticationProcessor.java:1091)
at org.keycloak.keycloak-services@16.1.0//org.keycloak.authentication.AuthenticationProcessor.authenticationAction(AuthenticationProcessor.java:958)
at org.keycloak.keycloak-services@16.1.0//org.keycloak.services.resources.LoginActionsService.processFlow(LoginActionsService.java:312)
at org.keycloak.keycloak-services@16.1.0//org.keycloak.services.resources.LoginActionsService.processAuthentication(LoginActionsService.java:283)
at org.keycloak.keycloak-services@16.1.0//org.keycloak.services.resources.LoginActionsService.authenticate(LoginActionsService.java:267)
at org.keycloak.keycloak-services@16.1.0//org.keycloak.services.resources.LoginActionsService.authenticateForm(LoginActionsService.java:340)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.resteasy.resteasy-core@4.7.4.Final//org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:170)
at org.jboss.resteasy.resteasy-core@4.7.4.Final//org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:130)
at org.jboss.resteasy.resteasy-core@4.7.4.Final//org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(
Detail info has been inform in https://stackoverflow.com/questions/66701269/resteasyclient-incompatibleclasschangeerror-resteasyproviderfactory-getcontextd
Anything else?
No response
Fixed by
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:7 (3 by maintainers)
Top GitHub Comments
I can confirm this issue. I get errors like these: [org.keycloak.services.error.KeycloakErrorHandler] (default task-23) Uncaught server error: java.lang.NoSuchMethodError: ‘org.jboss.resteasy.spi.ResteasyUriInfo org.jboss.resteasy.spi.HttpRequest.getUri()’
Gradle dependency tree: ±-- org.keycloak:keycloak-services:16.1.0 | ±-- org.jboss.resteasy:resteasy-multipart-provider:3.15.1.Final
Packaged runtime: 4.7.4.Final
For me, adding these gradle dependencies to my project, fixed the issue:
// Fix for https://github.com/keycloak/keycloak/issues/9599 set resteasy depencencies explicit to version packaged with Keycloak versions.resteasy = ‘4.7.4.Final’ compileOnly ‘org.jboss.resteasy:resteasy-client:’ + versions.resteasy compileOnly ‘org.jboss.resteasy:resteasy-jackson2-provider:’ + versions.resteasy compileOnly ‘org.jboss.resteasy:resteasy-multipart-provider:’ + versions.resteasy compileOnly ‘org.jboss.resteasy:resteasy-jaxb-provider:’ + versions.resteasy