Bas Dalenoord Bas Dalenoord - 1 month ago 9
Java Question

Keycloak's Spring Boot adapter with Jetty causing seemingly unrelated exceptions

I'm experiencing an issue whilst trying to secure a small Jetty-based Spring Boot application using Keycloak.

I'm following this tutorial for the backend part (skipping the Angular-specific bits), but as soon as I include the

keycloak-spring-boot-adapter
my application does not start and throws a couple of seemingly unrelated stacktraces. From the stacktraces it seems the autoconfiguration cannot resolve the
ServletContext
for some unknown reason.

I've created a stripped down sample of my application with which I'm able to reproduce the issue. It can be found on GitHub. Clean cloning the repo and calling
mvn clean package && java -jar target/api-0.0.1-SNAPSHOT.war
results in the stacktrace found in the README.

Has anyone got an idea why adding the dependency borks up my autoconfiguration?

Answer

This is actually a bug in the keycloak-spring-boot-adapter, for which I've now filed a bugreport and pull request.

Bugreport
PR

The pull request hasn't been merged at the time of writing, but it should be soon.

Comments