Keycloak 17 quarkas distribution build failing after adding custom provider
See original GitHub issueDescribe the bug
I’ve some custom providers extending keycloak functionality by adding new rest endpoints, this used to work fine until we upgraded to keycloak 17 (Quarkas distribution), the build is failing with below error
ERROR: Failed to run 'build' command. ERROR: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 1 deployment problems: [1] Unsatisfied dependency for type org.keycloak.models.KeycloakSession and qualifiers [@Default] - java member: com.test.swagger.SwaggerJsonRetriever().session - declared on CLASS bean [types=[com.test.swagger.SwaggerJsonRetriever, java.lang.Object], qualifiers=[@Default, @Any], target=com.barco.edp.eis.apidoc.swagger.SwaggerJsonRetriever]
The SwaggerJsonRetriever
is a custom provider which implements RealmResourceProvider
and it’s instance is being created by MetricsResourceProviderFactory
whihc implements RealmResourceProviderFactory
and all the ProviderFactory are listed under META-INF/services/org.keycloak.services.resource.RealmResourceProviderFactory.
I also made sure of that none of the keycloak libraries are packed into the jar (with dependencies) as well.
Is it a known issue or I’m missing some configuration.
Version
17.0.0
Expected behavior
The keycloak build should complete successfully and the rest endpoints should register and work.
Actual behavior
The keycloak build is failing after adding custom providers jars to {KEYCLOAK_HOME}/providers folder.
How to Reproduce?
Try adding a new custom provider to keycloak/providers
folder and then run keycloak/binkc.sh build
Anything else?
No response
Issue Analytics
- State:
- Created a year ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
I’m using Keykloak 18.0.0 and I just encountered the same error.
I could not remove the
@Path
-annotation, because my RESTful interfaces come from a lib. I don’t want to copy (and modify) the interfaces, but use the original ones from the lib. The@Path
is already in these interfaces – not in my Keycloak-specific implementation-class.Fortunately, I found that adding a protected default-constructor (without any argument) to my RESTful resource-implementations solves the problem, too. This way, I could continue to use the real interfaces, even though they have the
@Path
-annotation, but Quarkus does not any longer try to inject theKeycloakSession
. It seems to be smart enough to switch to the default-constructor during thekc.sh build
-process.During runtime, it uses my
RealmResourceProviderFactory
-implementations to create the instances, just like it did before with WildFly.My default-constructors seem to be never actually used, which is good since they would throw exceptions 😏
@akhil6095 I’ve successfully tested our custom SPI’s to Keycloak 17. What did you mean with “endpoints are not getting registered anymore.”? How do you deploy your SPI’s? Migrating to quarkus