NokiaTube | New address | Mode Phone | On high quality
Skip to content

keycloak-admin-client puts both commons-logging and commons-logging-jboss-logging on the runtime classpath #265

Backlog

Description

@adamschoenemann

keycloak-admin-client brings two artifacts onto a consumer's runtime classpath that both define the org.apache.commons.logging API:

  • org.jboss.logging:commons-logging-jboss-logging (runtime scope), declared by keycloak-client-common-synced.
  • commons-logging:commons-logging, requested by org.apache.httpcomponents:httpclient, which comes in through org.jboss.resteasy:resteasy-client.

Dependency paths, seen with 26.0.12 and still declared the same way in the 26.0.13 poms AFAICS:

keycloak-admin-client
 ├─ resteasy-client 6.2.15.Final
 │   └─ httpclient 4.5.14
 │       └─ commons-logging 1.2
 └─ keycloak-client-common-synced
     └─ commons-logging-jboss-logging 2.0.0.Final

The coordinates differ, so neither Maven nor Gradle treats them as versions of the same module, and both jars end up on the classpath.
These classes are defined in both jars, with different bytecode:

  • org.apache.commons.logging.Log
  • org.apache.commons.logging.LogFactory
  • org.apache.commons.logging.LogConfigurationException
  • org.apache.commons.logging.impl.NoOpLog
  • org.apache.commons.logging.impl.SimpleLog

Classpath order decides which LogFactory is loaded.
With the Apache jar first, commons-logging-jboss-logging is never used.
With the JBoss jar first, its LogFactory runs next to the Apache jar's remaining impl classes.
Classpath collision checks flag the overlap, so consumers have to exclude one of the two by hand.

Expected behaviour

Only one implementation of the commons-logging API comes in through keycloak-admin-client.

Suggested fix

Exclude commons-logging:commons-logging from the resteasy-client dependency in keycloak-admin-client.
commons-logging-jboss-logging provides the full API that httpclient uses.
The Quarkus Keycloak admin client extensions appear to do the same.

How to reproduce

Depend on org.keycloak:keycloak-admin-client:26.0.13 in a plain Maven or Gradle project and list the runtime classpath:

  • Maven: mvn dependency:tree -Dincludes=commons-logging,org.jboss.logging
  • Gradle: ./gradlew dependencies --configuration runtimeClasspath

Both commons-logging-*.jar and commons-logging-jboss-logging-*.jar are present.

Version

keycloak-admin-client 26.0.12 (observed at runtime) and 26.0.13 (not checked but I've no reason to be believe this is not still the case).

Activity

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

    No labels
    No labels

    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