[keycloak-user] Use keycloak classes from a custom Authenticator: NoClassDefFoundError

Christophe de Vienne christophe.devienne at orus.io
Wed Sep 4 10:50:18 EDT 2019


Hi Daniel,

That was it! Following the documentation you pointed allowed me to add
the necessary dependencies to the MANIFEST.MF file.

Thanks a lot

Christophe

Le 04/09/2019 à 16:24, Daniel.Meyerholt at eventim.de a écrit :
> Hi, 
> I do not know your exact project setup but you have to declare any dependencies as wildfly isolates classloaders.
> As AbstractIdpAuthenticator is included in the keycloak-services module, you can use this In the jar's META-INF/MANIFEST.MF:
> Dependencies: org.keycloak.keycloak-services
> 
> Maybe additional Modules have to be included as well.
> 
> See appropriate documentation of how to do this in your favourite build tool.
> 
> See http://docs.wildfly.org/17/Developer_Guide.html#ear-class-loading (applies to keycloak's jar mechanism as well)
> 
> Best
> Daniel
> 
> -----Ursprüngliche Nachricht-----
> Von: keycloak-user-bounces at lists.jboss.org <keycloak-user-bounces at lists.jboss.org> Im Auftrag von Christophe de Vienne
> Gesendet: Mittwoch, 4. September 2019 11:32
> An: keycloak-user at lists.jboss.org
> Betreff: [keycloak-user] Use keycloak classes from a custom Authenticator: NoClassDefFoundError
> 
> Hi everyone,
> 
> I want to write a custom Authenticator that borrow code from AbstractIdpAuthenticator (or better, extends it).
> 
> However, as soon as my authenticator attempts to load a class from the keycloak-services package, I get a NoClassDefFoundError. For example:
> 
> 08:24:53,608 ERROR [org.keycloak.services.error.KeycloakErrorHandler]
> (default task-6) Uncaught server error: java.lang.NoClassDefFoundError:
> org/keycloak/authentication/authenticators/broker/util/SerializedBrokeredIdentityContext
> 
> I used the authenticator example provided in the examples directory as a base for writing the pom.xml file.
> 
> Should I be able to use or extend keycloak classes from within my provider (packaged as a jar, I also tried wildfly:deploy)?
> 
> If so, what am I missing?
> 
> I also posted a question on stackoverflow, you may find some relevant detail in it:
> https://stackoverflow.com/questions/57778240/noclassdeffounderror-in-a-provider-jar-when-using-a-class-from-org-keycloak-auth
> 
> Thanks,
> 
> Christophe
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
> 
> 
> 
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
> 


More information about the keycloak-user mailing list