[keycloak-user] Custom Authenticator and NoClassDefFoundError

Dmitry Telegin dt at acutus.pro
Mon Jul 9 12:07:37 EDT 2018


Ryan,

Which version of Keycloak are you on? I was unable to reproduce the
issue neither on KC 4.0.0 nor on 4.1.0 (tested on a clean install). In
my environment the project builds and deploys OK via dropping to
standalone/deployments, I get no errors, and your authenticator
successfully appears in the GUI.

Dmitry Telegin
CTO, Acutus s.r.o.
Keycloak Consulting and Training

Pod lipami street 339/52, 130 00 Prague 3, Czech Republic
+42 (022) 888-30-71
E-mail: info at acutus.pro

On Mon, 2018-07-09 at 11:10 -0400, Ryan Slominski wrote:
> Hi Keycloak Users,
> 
> I'm attempting to create a custom authenticator by following the
> org.keycloak.examples.authenticator secret question example and https
> ://www.keycloak.org/docs/latest/server_development/index.html#_auth_s
> pi documentation.  When I drop the jar file into the deployments
> directory I get a NoClassDefFoundError.  I guess this has something
> to do with the JBoss module system.  I tried added a jboss-
> deployment-structure.xml file with the "org.keycloak.keycloak-
> services" module, but now I get a ModuleNotFoundError.  Any tips?
> 
> Source code for new authenticator:
> 
> https://github.com/slominskir/KeycloakAutoLinkAuthenticator
> 
> NoClassDefFoundError:
> 
> 2018-07-09 10:09:34,112 INFO  [org.jboss.as.repository]
> (DeploymentScanner-threads - 1) WFLYDR0001: Content added at location
> /opt/wildfly/keycloak-
> 3.4.3/standalone/data/content/39/b99d3fa522078162e540b84481c8ff7c1fb3
> 46/content
> 2018-07-09 10:09:34,136 INFO  [org.jboss.as.server.deployment] (MSC
> service thread 1-2) WFLYSRV0027: Starting deployment of
> "AutoLinkAuthenticator.jar" (runtime-name:
> "AutoLinkAuthenticator.jar")
> 2018-07-09 10:09:34,213
> INFO  [org.keycloak.subsystem.server.extension.KeycloakProviderDeploy
> mentProcessor] (MSC service thread 1-2) Deploying Keycloak provider:
> AutoLinkAuthenticator.jar
> 2018-07-09 10:09:34,219 WARN  [org.jboss.modules] (MSC service thread
> 1-2) Failed to define class
> org.keycloak.extras.authentication.authenticators.broker.AutoLinkAuth
> enticator in Module "deployment.AutoLinkAuthenticator.jar" from
> Service Module Loader: java.lang.NoClassDefFoundError: Failed to link
> org/keycloak/extras/authentication/authenticators/broker/AutoLinkAuth
> enticator (Module "deployment.AutoLinkAuthenticator.jar" from Service
> Module Loader):
> org/keycloak/authentication/authenticators/broker/AbstractIdpAuthenti
> cator
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
> orAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
> onstructorAccessorImpl.java:45)
>         at
> java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>         at
> org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.jav
> a:446)
>         at
> org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.
> java:274)
>         at
> org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoade
> r.java:77)
>         at org.jboss.modules.Module.loadModuleClass(Module.java:713)
>         at
> org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:
> 190)
>         at
> org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(Con
> currentClassLoader.java:412)
>         at
> org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentCl
> assLoader.java:400)
>         at
> org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoad
> er.java:116)
>         at
> org.keycloak.extras.authentication.authenticators.broker.AutoLinkAuth
> enticatorFactory.<clinit>(AutoLinkAuthenticatorFactory.java:14)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
> orAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
> onstructorAccessorImpl.java:45)
>         at
> java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>         at java.lang.Class.newInstance(Class.java:442)
>         at
> java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:3
> 80)
>         at
> java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
>         at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
>         at
> org.keycloak.provider.DefaultProviderLoader.load(DefaultProviderLoade
> r.java:47)
>         at
> org.keycloak.provider.ProviderManager.load(ProviderManager.java:93)
>         at
> org.keycloak.services.DefaultKeycloakSessionFactory.loadFactories(Def
> aultKeycloakSessionFactory.java:213)
>         at
> org.keycloak.services.DefaultKeycloakSessionFactory.deploy(DefaultKey
> cloakSessionFactory.java:114)
>         at
> org.keycloak.provider.ProviderManagerRegistry.deploy(ProviderManagerR
> egistry.java:42)
>         at
> org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentPro
> cessor.deploy(KeycloakProviderDeploymentProcessor.java:54)
>         at
> org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(Deplo
> ymentUnitPhaseService.java:165)
>         at
> org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
> rviceControllerImpl.java:2032)
>         at
> org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
> rollerImpl.java:1955)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
> java:1149)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
> .java:624)
>         at java.lang.Thread.run(Thread.java:748)
> 
> 
> ModuleNotFoundError:
> 
> 2018-07-09 10:40:55,135 ERROR [org.jboss.msc.service.fail] (MSC
> service thread 1-4) MSC000001: Failed to start service
> jboss.module.service."deployment.AutoLinkAuthenticator.jar".main:
> org.jboss.msc.service.StartException in service
> jboss.module.service."deployment.AutoLinkAuthenticator.jar".main:
> WFLYSRV0179: Failed to load module:
> deployment.AutoLinkAuthenticator.jar
>         at
> org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadS
> ervice.java:91)
>         at
> org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
> rviceControllerImpl.java:2032)
>         at
> org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
> rollerImpl.java:1955)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
> java:1149)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
> .java:624)
>         at java.lang.Thread.run(Thread.java:748)
> Caused by: org.jboss.modules.ModuleNotFoundException: keycloak-
> services
>         at org.jboss.modules.Module.addPaths(Module.java:1217)
>         at org.jboss.modules.Module.link(Module.java:1573)
>         at
> org.jboss.modules.Module.relinkIfNecessary(Module.java:1601)
>         at
> org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:287)
>         at
> org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:271)
>         at
> org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadS
> ervice.java:68)
>         ... 5 more
> 
> Thanks,
> 
> Ryan
> _______________________________________________
> 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