Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkageError for FipsMode during startup #16202

Closed
2 tasks done
yalpertem opened this issue Dec 30, 2022 · 1 comment
Closed
2 tasks done

LinkageError for FipsMode during startup #16202

yalpertem opened this issue Dec 30, 2022 · 1 comment
Labels
area/core kind/bug Categorizes a PR related to a bug
Milestone

Comments

@yalpertem
Copy link

yalpertem commented Dec 30, 2022

Before reporting an issue

  • I have searched existing issues
  • I have reproduced the issue with the latest release

Area

core

Describe the bug

After upgrading from 19.0.3 to 20.0.2, I'm getting an error during the startup as follows:

Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step org.keycloak.quarkus.deployment.KeycloakProcessor#setCryptoProvider threw an exception: 
java.lang.LinkageError: loader constraint violation: 
loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @75ed9710 
wants to load class org.keycloak.common.crypto.FipsMode.
A different class with the same name was previously loaded by java.net.URLClassLoader @2e377400. 
(org.keycloak.common.crypto.FipsMode is in unnamed module of loader java.net.URLClassLoader 
@2e377400, parent loader 'app')
...
at io.quarkus.deployment.recording.BytecodeRecorderImpl$$RecordingProxyProxy2.setCryptoProvider(Unknown Source)
at org.keycloak.quarkus.deployment.KeycloakProcessor.setCryptoProvider(KeycloakProcessor.java:607)

Version

20.0.2

Expected behavior

No runtime errors during the startup.

Actual behavior

java.lang.LinkageError for FipsMode during the startup.

How to Reproduce?

I couldn't find a way to reproduce the issue in a simple setup as I'm using Keycloak with some customizations like adding certificates via keytool and adding some custom SPI implementations (tried building the jar both with Java 11 and Java 17).

Using the base image quay.io/keycloak/keycloak:20.0.2

.conf file:

spi-user-profile-provider=custom-profile
spi-email-template-freemarker-enabled=false
spi-connections-jpa-default-migration-strategy=update
spi-events-listener-email-exclude-events=LOGIN_ERROR
http-enabled=true
hostname-strict=false
hostname-strict-https=false
features=
features-disabled=admin2
metrics-enabled=true
health-enabled=true

Run command:

/opt/keycloak/bin/kc.sh --verbose -cf /opt/keycloak/conf/keycloak.conf start-dev --debug --proxy edge

Anything else?

I'm reading #14895 which introduced the FipsMode class but couldn't understand the reason yet.

@yalpertem yalpertem added kind/bug Categorizes a PR related to a bug status/triage labels Dec 30, 2022
@ghost ghost added the area/core label Dec 30, 2022
@yalpertem
Copy link
Author

yalpertem commented Dec 30, 2022

My bad, fixed it by changing

	implementation "org.keycloak:keycloak-client-registration-api:$keycloakVersion"

to

	implementation("org.keycloak:keycloak-client-registration-api:$keycloakVersion") {
		exclude group: 'org.keycloak', module: 'keycloak-core'
		exclude group: 'org.keycloak', module: 'keycloak-common'
		exclude group: 'org.keycloak', module: 'keycloak-server-spi'
		exclude group: 'org.keycloak', module: 'keycloak-server-spi-private'
	}

in my gradle config for the SPI implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core kind/bug Categorizes a PR related to a bug
Projects
None yet
Development

No branches or pull requests

2 participants