question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RestEasy library inconsistency

See original GitHub issue

Describe 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>

image

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:open
  • Created 2 years ago
  • Reactions:4
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
joeri-jansencommented, Jan 19, 2022

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

1reaction
joeri-jansencommented, Mar 8, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected transitive import of resteasy when using ... - GitHub
Based on the discussion in #15400 this appears to be a transitive import issue causing the non-reactive versions of RESTeasy being imported. It...
Read more >
JBoss Inconsistent stack height 2 != 1 - java
I'm successfully able to deploy the RESTEasy application on JBoss instance but when I'm trying to invoke the service it is throwing me...
Read more >
RESTEasy vulnerability (CVE-2021-20289) - Bloomreach
A flaw was found in RESTEasy in all versions of RESTEasy up to 4.6.0.Final. The endpoint class and method names are returned as...
Read more >
[WFLY-16783] [wsconsume.sh] Inconsistency in supported JAX-WS ...
Our inner QE test suite has a couple of simple tests that verify the output of wscomsume.sh while generating classes/sources files.
Read more >
Thousands of ballots rejected statewide based on signature ...
Thousands of ballots rejected statewide based on signature inconsistencies. Nov. 1, 2022 Updated Tue., Nov. 1, 2022 at 9:11 p.m.. An election ballot...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found