When trying to run my webapplication in both an embedded jetty (locally) and a 'normal' jetty instance (remotely), I think I encounter some class collision.
java.lang.ClassCastException:
org.keycloak.adapters.RefreshableKeycloakSecurityContext cannot be cast to org.keycloak.KeycloakSecurityContext
The class KeycloakSecurityContext
is both defined in the keycloak-jetty-adapter
dependency and in the keycloak-core
dependency in my project. (same version, 3.4.3 Final)
I've tried using scope 'provided' on the adapter or excluding the keycloak-core dependency from my adapter, but to no effect. Any suggestions how to handle this combination?
I had similar issues with Keycloak. You need to make sure that libraries are not duplicated.