[keycloak-user] Receive "NoClassDefFoundError" during *deployment* not at _runtime_ with/by java class derivation (Here: the unpacked attachment)
Christian Kayssner
Christian.Kayssner at muthpartners.de
Thu Sep 21 03:58:59 EDT 2017
Hallo,
> 4. and the unpacked attachment.
ok, here no attachments. Therefore inline (with an stripped log-file) in the sequence of using/generating:
<01.patch.it>
#!/bin/bash
# Object of the patch
name="keycloak-demo-3.2.1.Final"
# Remove the (last) ruins
rm -fR "${name}"
# Provide the original
tar -xzf "${name}.tar.gz"
# Patch the base
patch -p 0 < "${name}.patch"
# and run
"${name}/keycloak/bin/standalone.sh" | tee "${name}.log"
</01.patch.it>
<keycloak-demo-3.2.1.Final.patch>
diff -Naur keycloak-demo-3.2.1.Final/examples/providers/authenticator/src/main/java/org/example/derivations/MyUsernamePasswordFormFactory.java keycloak-demo-3.2.1.Final-modified/examples/providers/authenticator/src/main/java/org/example/derivations/MyUsernamePasswordFormFactory.java
--- keycloak-demo-3.2.1.Final/examples/providers/authenticator/src/main/java/org/example/derivations/MyUsernamePasswordFormFactory.java 1970-01-01 00:00:00.000000000 +0000
+++ keycloak-demo-3.2.1.Final-modified/examples/providers/authenticator/src/main/java/org/example/derivations/MyUsernamePasswordFormFactory.java 2017-09-20 11:37:09.425674263 +0000
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.example.derivations;
+
+import org.keycloak.authentication.authenticators.browser.UsernamePasswordFormFactory;
+
+/**
+ */
+public//
+class MyUsernamePasswordFormFactory//
+ extends UsernamePasswordFormFactory//
+{
+ public//
+ static//
+ final//
+ String PROVIDER_ID = "my-auth-username-password-form";
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public//
+ String getId()//
+ {
+ return MyUsernamePasswordFormFactory.PROVIDER_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @return The heading for the (browser) page to explain the necessary inputs.
+ */
+ @Override
+ public//
+ String getDisplayType()//
+ {
+ return "My Username Password Form";
+ }
+}
diff -Naur keycloak-demo-3.2.1.Final/examples/providers/authenticator/src/main/resources/META-INF/services/org.keycloak.authentication.AuthenticatorFactory keycloak-demo-3.2.1.Final-modified/examples/providers/authenticator/src/main/resources/META-INF/services/org.keycloak.authentication.AuthenticatorFactory
--- keycloak-demo-3.2.1.Final/examples/providers/authenticator/src/main/resources/META-INF/services/org.keycloak.authentication.AuthenticatorFactory 2017-07-21 11:31:26.000000000 +0000
+++ keycloak-demo-3.2.1.Final-modified/examples/providers/authenticator/src/main/resources/META-INF/services/org.keycloak.authentication.AuthenticatorFactory 2017-09-20 11:43:31.354018042 +0000
@@ -15,4 +15,5 @@
# limitations under the License.
#
-org.keycloak.examples.authenticator.SecretQuestionAuthenticatorFactory
\ No newline at end of file
+org.keycloak.examples.authenticator.SecretQuestionAuthenticatorFactory
+org.example.derivations.MyUsernamePasswordFormFactory
\ No newline at end of file
diff -Naur keycloak-demo-3.2.1.Final/keycloak/modules/layers.conf keycloak-demo-3.2.1.Final-modified/keycloak/modules/layers.conf
--- keycloak-demo-3.2.1.Final/keycloak/modules/layers.conf 1970-01-01 00:00:00.000000000 +0000
+++ keycloak-demo-3.2.1.Final-modified/keycloak/modules/layers.conf 2017-07-21 09:11:58.000000000 +0000
@@ -0,0 +1 @@
+layers=keycloak
\ No newline at end of file
</keycloak-demo-3.2.1.Final.patch>
<02.deploy.it>
#!/bin/bash
# Choose the patched example
cd keycloak-demo-3.2.1.Final/examples/providers/authenticator
# And generate the error
mvn clean \
install \
wildfly:deploy
<02.deploy.it>
<keycloak-demo-3.2.1.Final.log>
[0m [0m17:38:42,392 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 17194ms - Started 459 of 836 services (561 services are lazy, passive or on-demand)
[0m [0m17:39:08,074 INFO [org.jboss.as.repository] (management-handler-thread - 4) WFLYDR0001: Content added at location /path/to/your/own/playground/keycloak-demo-3.2.1.Final/keycloak/standalone/data/content/e4/95f32235bb131df52f479a09827186a3265788/content
[0m [0m17:39:08,082 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "authenticator-required-action-example.jar" (runtime-name: "authenticator-required-action-example.jar")
[0m [0m17:39:08,322 INFO [org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor] (MSC service thread 1-1) Deploying Keycloak provider: authenticator-required-action-example.jar
[0m [33m17:39:08,335 WARN [org.jboss.modules] (MSC service thread 1-1) Failed to define class org.example.derivations.MyUsernamePasswordFormFactory in Module "deployment.authenticator-required-action-example.jar:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link org/example/derivations/MyUsernamePasswordFormFactory (Module "deployment.authenticator-required-action-example.jar:main" from Service Module Loader): org/keycloak/authentication/authenticators/browser/UsernamePasswordFormFactory
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:605)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.keycloak.provider.DefaultProviderLoader.load(DefaultProviderLoader.java:47)
at org.keycloak.provider.ProviderManager.load(ProviderManager.java:93)
at org.keycloak.services.DefaultKeycloakSessionFactory.loadFactories(DefaultKeycloakSessionFactory.java:208)
at org.keycloak.services.DefaultKeycloakSessionFactory.deploy(DefaultKeycloakSessionFactory.java:114)
at org.keycloak.provider.ProviderManagerRegistry.deploy(ProviderManagerRegistry.java:42)
at org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor.deploy(KeycloakProviderDeploymentProcessor.java:54)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
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)
[0m [31m17:39:08,336 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."authenticator-required-action-example.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."authenticator-required-action-example.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "authenticator-required-action-example.jar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
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: java.lang.NoClassDefFoundError: Failed to link org/example/derivations/MyUsernamePasswordFormFactory (Module "deployment.authenticator-required-action-example.jar:main" from Service Module Loader): org/keycloak/authentication/authenticators/browser/UsernamePasswordFormFactory
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:605)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.keycloak.provider.DefaultProviderLoader.load(DefaultProviderLoader.java:47)
at org.keycloak.provider.ProviderManager.load(ProviderManager.java:93)
at org.keycloak.services.DefaultKeycloakSessionFactory.loadFactories(DefaultKeycloakSessionFactory.java:208)
at org.keycloak.services.DefaultKeycloakSessionFactory.deploy(DefaultKeycloakSessionFactory.java:114)
at org.keycloak.provider.ProviderManagerRegistry.deploy(ProviderManagerRegistry.java:42)
at org.keycloak.subsystem.server.extension.KeycloakProviderDeploymentProcessor.deploy(KeycloakProviderDeploymentProcessor.java:54)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
[0m [31m17:39:08,339 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 4) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "authenticator-required-action-example.jar")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"authenticator-required-action-example.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"authenticator-required-action-example.jar\".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"authenticator-required-action-example.jar\"
Caused by: java.lang.NoClassDefFoundError: Failed to link org/example/derivations/MyUsernamePasswordFormFactory (Module \"deployment.authenticator-required-action-example.jar:main\" from Service Module Loader): org/keycloak/authentication/authenticators/browser/UsernamePasswordFormFactory"}}
[0m [31m17:39:08,341 ERROR [org.jboss.as.server] (management-handler-thread - 4) WFLYSRV0021: Deploy of deployment "authenticator-required-action-example.jar" was rolled back with the following failure message:
{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"authenticator-required-action-example.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"authenticator-required-action-example.jar\".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"authenticator-required-action-example.jar\"
Caused by: java.lang.NoClassDefFoundError: Failed to link org/example/derivations/MyUsernamePasswordFormFactory (Module \"deployment.authenticator-required-action-example.jar:main\" from Service Module Loader): org/keycloak/authentication/authenticators/browser/UsernamePasswordFormFactory"}}
[0m [0m17:39:08,356 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0028: Stopped deployment authenticator-required-action-example.jar (runtime-name: authenticator-required-action-example.jar) in 14ms
[0m [0m17:39:08,357 INFO [org.jboss.as.controller] (management-handler-thread - 4) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."authenticator-required-action-example.jar".POST_MODULE
[0m
</keycloak-demo-3.2.1.Final.log>
Best regards.
Christian Kayssner
--
G. Muth Partners GmbH
Borsigstraße 32
D - 65205 Wiesbaden
HRB 10196 Amtsgericht Wiesbaden
Geschäftsführer: Klaus Gockel / Oliver Mächold
Tel. : +49(0)6122/5981-0
FAX. : +49(0)6122/5981-50
eMail: christian.kayssner at muthpartners.de
www : www.muthpartners.de
More information about the keycloak-user
mailing list