Uncaught server error: java.lang.NoClassDefFoundError when implementing Authenticator


I just recently tackled a project of extending the “forgot password” feature in keycloak and have been at a standstill for some days now.

I’m implementing the Authenticator and AuthenticatorFactory and getting the following error when using the token class:
08:32:56,942 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-1) Uncaught server error: java.lang.NoClassDefFoundError: org/keycloak/authentication/actiontoken/resetcred/ResetCredentialsActionToken

This error points me in a missing dependency, so i’ve added the following to my pom.xml:

None of the above worked, still getting the same error.

Everything seems to be related to the following line in my code:
ResetCredentialsActionToken token = new ResetCredentialsActionToken(user.getId(), absoluteExpirationInSecs, authSessionEncodedId, authenticationSession.getClient().getClientId());

I can’t seem to find the right dependency, any help would be appreciated.

Thank you!


take a look at the readme in one of the examples I provide. The Keycloak config section points to a configuration you need to make in standalone-ha.xml and declare modules you want to use as global.

Thank you zonaut, this actually fixed my problem.

I can probably figure the following by myself, but in case you’re aware of it already, do i still need to include the keycloak-service in my POM dependency or the global-modules setting is sufficient?

If it compiles, builds and runs without …

Quick update in this issue, there is no need to define the global-modules in the standalone-ha.xml file.
My mistake was putting the jboss-deployment-structure.xml file in the wrong directory in the examples, these need to be under the META-INF folder. The repo contains correct examples now.