FFFF RestEasy library inconsistency · Issue #9599 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

RestEasy library inconsistency #9599

Closed as not planned
Closed as not planned

Description

@albertoSoto

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

Activity

  1. joeri-jansen commented on Jan 19, 2022

    @joeri-jansen

    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

  2. stianst commented on Jan 27, 2022

    @stianst
    Contributor

    I'm afraid this is something we have to live with for a little bit since the Keycloak parent is shared between Quarkus dist, WildFly dist, and adapters.

    In the meantime I suggest using the BOMs for WildFly or Quarkus to get the correct dependencies.

  3. added
    area/coreCore server — startup, configuration, providers/SPIs, cross-cutting concerns
    status/holdPR should not be merged. On hold for later.
    and removed
    status/holdPR should not be merged. On hold for later.
    on Jan 27, 2022
  4. CollinAlpert commented on Mar 8, 2022

    @CollinAlpert
    Contributor

    @stianst I am also running into the NoSuchMethodError when calling getUri(). Is there any workaround for this right now?

  5. joeri-jansen commented on Mar 8, 2022

    @joeri-jansen

    For me, adding these gradle dependencies to my project, fixed the issue:

    // Fix for #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

  6. CollinAlpert commented on Mar 10, 2022

    @CollinAlpert
    Contributor

    @joeri-jansen Thanks a lot, this works. I have found that adding only resteasy-multipart-provider is enough.

  7. abstractj commented on Mar 10, 2022

    @abstractj
    Contributor

    @stianst there's a mismatch between the current RESTEasy versions:

    operator/pom.xml
    23:        <resteasy.version>4.7.4.Final</resteasy.version>
    
    quarkus/pom.xml
    40:        <resteasy.version>4.7.5.Final</resteasy.version>
    
    pom.xml
    96:        <resteasy.version>3.15.1.Final</resteasy.version>
    

    For the Operator, I already submitted a ticket #10702. Should we create a ticket to update the main POM? Considering that the Quarkus distribution is up-to-date, the deprecation of our adapters, and we will face several breaking changes, I wanted to double-check with you if worth the effort.

  8. abstractj commented on Apr 7, 2022

    @abstractj
    Contributor

    The mismatch between the Operator and Quarkus distribution was fixed, please see:

    operator/pom.xml
    23:        <resteasy.version>4.7.5.Final</resteasy.version>
    
    quarkus/pom
    6ED0
    .xml
    40:        <resteasy.version>4.7.5.Final</resteasy.version>
    

    It is still necessary to update the main POM file, and Pedro started to work on this. Please check: #10917

  9. abstractj commented on Dec 22, 2022

    @abstractj
    Contributor

    Resolved #10917

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreCore server — startup, configuration, providers/SPIs, cross-cutting concernskind/bugCategorizes a PR related to a bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0