KeyCloak.x kc.sh config QuarkusClassLoader error

Hello all, I am trying to add a user storage provider JAR file to a KeyCloak.x instance. I am getting the following error when running ./kc.sh config:

ERROR: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#build threw an exception: java.lang.LinkageError: loader constraint violation: loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @2eae8e6e wants to load interface org.hibernate.boot.archive.scan.spi.Scanner. A different interface with the same name was previously loaded by java.net.URLClassLoader @954b04f. (org.hibernate.boot.archive.scan.spi.Scanner is in unnamed module of loader java.net.URLClassLoader @954b04f, parent loader 'app')

Attempts made to resolve this:

  • Added the following to keycloak.properties
quarkus.class-loading.parent-first-artifacts=org.hibernate:hibernate-core
  • Verified that the user storage SPI and keycloak.x were using the same version of org.hibernate:hibernate-core. Version in use is 5.1.29.Final.

Is there something Iā€™m missing here?

1 Like

hi, i have faced same problem, i solved by making customized SPI jar maven hibernate-core dependency to provided scope, i.e

 <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.3.20.Final</version>
            <scope>provided</scope>
        </dependency>

i am using keycloak.X 17.0.1