[keycloak-user] java.lang.NoClassDefFoundError in a customized Reset password authentication flow

GESLIN Fabrice fabrice.geslin-prestataire at laposte.fr
Wed Apr 3 03:39:28 EDT 2019


Hi,

After having added a few more dependencies in the jboss-deployment-structure.xml, it works.

Thank you for your kind and appreciated help Marek.

Regards,

Fabrice Geslin

-----Message d'origine-----
De : Marek Posolda [mailto:mposolda at redhat.com] 
Envoyé : mardi 2 avril 2019 21:45
À : GESLIN Fabrice <fabrice.geslin-prestataire at laposte.fr>; keycloak-user at lists.jboss.org
Objet : Re: [keycloak-user] java.lang.NoClassDefFoundError in a customized Reset password authentication flow

On 02/04/2019 20:06, GESLIN Fabrice wrote:
> Thanks for the answer Marek but unfortunately adding the jboss-deployment-structure.xml to the META-INF of our jar doesn't solve the problem.
>
> FYI, we've previously implemented a custom Username Password Form authenticator that imports and uses some classes from  the keycloak-services module and we didn't have to explicitly specify the dependencies in an xml file.
>
> Is there anything special with the ResetCredentialsActionToken class or its package ?

No, there is nothing special in this class. Just maybe that it inherits from some classes/interfaces from other keycloak modules. So maybe you need to add few more modules like keycloak-server-spi and keycloak-server-spi-private.

If you still see issues, I suggest to try for example:

- Deploy as a WAR instead of JAR (Same like the quickstart I pointed is
doing)
- Deploy your JAR as a module rather than the file directly deployed in standalone/deployments

Marek

>
> Regards,
>
> Fabrice Geslin
>
> -----Message d'origine-----
> De : Marek Posolda [mailto:mposolda at redhat.com] Envoyé : mardi 2 avril 
> 2019 16:56 À : GESLIN Fabrice <fabrice.geslin-prestataire at laposte.fr>; 
> keycloak-user at lists.jboss.org Objet : Re: [keycloak-user] 
> java.lang.NoClassDefFoundError in a customized Reset password 
> authentication flow
>
> Hi,
>
> I think this error is due the fact that file jboss-deployment-structure.xml is either missing or it is missing the references to needed jboss module with the class org/keycloak/authentication/actiontoken/resetcred/ResetCredentialsActionToken.
> Which I think is the module "org.keycloak.keycloak-services" .
>
> For some more reference, see for example this quickstart 
> https://github.com/keycloak/keycloak-quickstarts/tree/latest/action-to
> ken-authenticator
> and especially this file in it
> https://github.com/keycloak/keycloak-quickstarts/blob/latest/action-to
> ken-authenticator/src/main/webapp/WEB-INF/jboss-deployment-structure.x
> ml
> .
>
> Hope this helps,
> Marek
>
> On 02/04/2019 14:34, GESLIN Fabrice wrote:
>> Hi,
>>
>>
>> We're trying to customize the reset password flow by providing a 
>> custom authenticator
>>
>> ResetCredentialEmailSms to replace the ResetCredentialEmail provided 
>> by default in Keycloak
>>
>>
>> In our ResetCredentialEmailSms class, as in the original ResetCredentialEmail, we're importing and using the org.keycloak.authentication.actiontoken.resetcred.ResetCredentialsActionToken class .
>>
>>
>> We can build our authenticator successfully with no warning or error of any kind but at runtime we got the following issue :
>>
>>
>> ^[[36mkeycloak    |^[[0m ^[[0m^[[31m12:06:43,542 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (default task-1) Uncaught server error: java.lang.NoClassDefFoundError: org/keycloak/authentication/actiontoken/resetcred/ResetCredentialsActionToken
>> ^[[36mkeycloak    |^[[0m        at moncompte.oidcprovider.authentication.authenticators.resetcred.ResetCredentialEmailSms.authenticate(ResetCredentialEmailSms.java:85)
>> ^[[36mkeycloak    |^[[0m        at org.keycloak.authentication.DefaultAuthenticationFlow.processFlow(DefaultAuthenticationFlow.java:221)
>> ^[[36mkeycloak    |^[[0m        at org.keycloak.authentication.DefaultAuthenticationFlow.processAction(DefaultAuthenticationFlow.java:117)
>> ^[[36mkeycloak    |^[[0m        at org.keycloak.authentication.AuthenticationProcessor.authenticationAction(AuthenticationProcessor.java:873)
>> ^[[36mkeycloak    |^[[0m        at org.keycloak.services.resources.LoginActionsService.processFlow(LoginActionsService.java:292)
>> ^[[36mkeycloak    |^[[0m        at org.keycloak.services.resources.LoginActionsService.processResetCredentials(LoginActionsService.java:622)
>> ^[[36mkeycloak    |^[[0m        at org.keycloak.services.resources.LoginActionsService.resetCredentials(LoginActionsService.java:414)
>> ^[[36mkeycloak    |^[[0m        at org.keycloak.services.resources.LoginActionsService.resetCredentialsPOST(LoginActionsService.java:337)
>> ^[[36mkeycloak    |^[[0m        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> ^[[36mkeycloak    |^[[0m        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> ^[[36mkeycloak    |^[[0m        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> ^[[36mkeycloak    |^[[0m        at java.lang.reflect.Method.invoke(Method.java:498)
>> ...
>>
>> [[36mkeycloak    |^[[0m        at java.lang.Thread.run(Thread.java:748)
>> ^[[36mkeycloak    |^[[0m Caused by: java.lang.ClassNotFoundException: org.keycloak.authentication.actiontoken.resetcred.ResetCredentialsActionToken from [Module "deployment.mon-compte-authentication-0.0.1.jar" from Service Module Loader]
>> ^[[36mkeycloak    |^[[0m        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
>> ^[[36mkeycloak    |^[[0m        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
>> ^[[36mkeycloak    |^[[0m        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
>> ^[[36mkeycloak    |^[[0m        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
>> ^[[36mkeycloak    |^[[0m        ... 77 more
>>
>> Any clue about what we did wrong ?
>>
>>
>> Fabrice Geslin
>>
>>
>> Groupe La Poste
>>
>>
>> Post-scriptum La Poste
>>
>> Ce message est confidentiel. Sous reserve de tout accord conclu par ecrit entre vous et La Poste, son contenu ne represente en aucun cas un engagement de la part de La Poste. Toute publication, utilisation ou diffusion, meme partielle, doit etre autorisee prealablement. Si vous n'etes pas destinataire de ce message, merci d'en avertir immediatement l'expediteur.
>> _______________________________________________
>> keycloak-user mailing list
>> keycloak-user at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
>
> Post-scriptum La Poste
>
> Ce message est confidentiel. Sous reserve de tout accord conclu par 
> ecrit entre vous et La Poste, son contenu ne represente en aucun cas 
> un engagement de la part de La Poste. Toute publication, utilisation ou diffusion, meme partielle, doit etre autorisee prealablement. Si vous n'etes pas destinataire de ce message, merci d'en avertir immediatement l'expediteur.



Post-scriptum La Poste

Ce message est confidentiel. Sous reserve de tout accord conclu par
ecrit entre vous et La Poste, son contenu ne represente en aucun cas un
engagement de la part de La Poste. Toute publication, utilisation ou
diffusion, meme partielle, doit etre autorisee prealablement. Si vous
n'etes pas destinataire de ce message, merci d'en avertir immediatement
l'expediteur.



More information about the keycloak-user mailing list