NoClassDefFoundError from Maven deploy when attempting to create a custom authenticator provider for Keycloak

I’m implementing a Keycloak authentication provider (for Keycloak 6.0.1) which returns a message when a user is temporarily locked (like specified at Keycloak Custom message on user temporary lock)

When I do mvn clean install wildfly:deploy I get :

[ERROR]     Caused by: java.util.ServiceConfigurationError: org.keycloak.authentication.AuthenticatorFactory: Provider could not be instantiated
[ERROR]     Caused by: java.lang.NoClassDefFoundError: Failed to link com/mumba/cloud/authenticator/LockedUserAuthenticator (Module \"deployment.lockeduser-authenticator-1.0-SNAPSHOT.jar\" from Service Module Loader): org/keycloak/authentication/authenticators/browser/UsernamePasswordForm"}}}}

I’m looking for some help on how to track down why I’m getting the java.lang.NoClassDefFoundError and why Maven (or maybe it’s wildfly) can’t seem to find org/keycloak/authentication/authenticators/browser/UsernamePasswordForm

It isn’t a compile-time error, and I believe my import statement below is correct for UsernamePasswordForm (see code below).

I also think I have correctly added the dependency (keycloak-services) to my pom.xml (see below).

I’m very new to Maven (and Java/Keycloak development), so I’m not sure where to dig to track this down.

Anyone have any pointers?


import org.keycloak.authentication.authenticators.browser.UsernamePasswordForm;

public class LockedUserAuthenticator extends UsernamePasswordForm  {
    protected String tempDisabledError() {
        return "ACCOUNT IS temporarily disabled.";

My pom.xml includes :



java maven wildfly

replied in the mailing list: Google Groups

tl;dr you need to have a manifest in your jar that says which keycloak modules you depend on

1 Like

Thanks heaps.

In case it helps someone else, I ended up with the following, which worked for my situation: