Repository navigation
|
I’m trying to make an external API call from within a custom Keycloak extension (SPI) and I want to implement a retry mechanism using Resilience4j. However, when I deploy my custom provider and trigger the code, I get a ClassNotFoundException for the Resilience4j classes (e.g., io.github.resilience4j.retry.Retry). Keycloak version : V24.0.5 I’ve added Resilience4j as a dependency in my custom provider’s pom.xml. I build it as a JAR and put it in the provider folder. Keycloak starts up fine, but when my code executes, it fails to find the Resilience4j classes. Error: Uncaught server error: java.lang.NoClassDefFoundError: io/github/resilience4j/retry/RetryConfig |
Replies: 1 comment
|
Does the dependency contain any other transitive dependencies? In that case, you'd need to add all these JARs to the providers folder as well as the dependency JAR, or using shaded JAR that contains all necessary JARS. You should also check if your extensions does not use The other approach is to use the keycloak-quarkus-extensions tool that provides you the ability to build your own Keycloak distribution with all the necessary transitive dependencies. Something like: ./kc-extension.sh add io.github.resilience4j:resilience4j-retry:2.3.0
./kc-extension.sh build
# you should be able to start the server with your dependency
./kc-extension.sh start-dev |
Does the dependency contain any other transitive dependencies? In that case, you'd need to add all these JARs to the providers folder as well as the dependency JAR, or using shaded JAR that contains all necessary JARS. You should also check if your extensions does not use
<scope>provided</scope>for the dependency.The other approach is to use the keycloak-quarkus-extensions tool that provides you the ability to build your own Keycloak distribution with all the necessary transitive dependencies.
Something like:
./kc-extension.sh add io.github.resilience4j:resilience4j-retry:2.3.0 ./kc-extension.sh build # you should be able to start the server with your dependency ./kc-extension.sh start-…