How to Solve Error Message java.lang.RuntimeException: UT010039: Unknown authentication mechanism KEYCLOAK when Deploying Java Application to Wildfly via NetBeans IDE

Posted on

Introduction

Another article about how to solve an error message as in the title of this article. Actually, the error message appear upon deploying a Java application to a Wildfly Application Server. The execution process is in a NetBeans IDE. So, the process is actually start by running the Java Application using the Run menu from the right click menu in the NetBeans IDE. When the process for building and compiling is finish, the rest is just deploying it to the Wildfly Application Server. The following is the output of the Output Tab which is part of NetBeans IDE :

2022-02-15 21:16:25,971 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 33) Initializing Mojarra 2.3.14.SP01 for context '/apps'
2022-02-15 21:16:27,509 INFO [net.bootsfaces.listeners.AddResourcesListener] (ServerService Thread Pool -- 33) This application is running on BootsFaces1.4.2-
2022-02-15 21:16:30,508 INFO [org.primefaces.webapp.PostConstructApplicationEventListener] (ServerService Thread Pool -- 33) Running on PrimeFaces 7.0.RC2
2022-02-15 21:16:30,605 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 33) MSC000001: Failed to start service jboss.deployment.unit."apps.war".undertow-deployment: org.jboss.msc.service.StartException in service jboss.deployment.unit."apps.war".undertow-deployment: java.lang.RuntimeException: java.lang.RuntimeException: UT010039: Unknown authentication mechanism KEYCLOAK
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:513)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: UT010039: Unknown authentication mechanism KEYCLOAK
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:257)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:96)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:78)
... 8 more
Caused by: java.lang.RuntimeException: UT010039: Unknown authentication mechanism KEYCLOAK
at io.undertow.servlet.core.DeploymentManagerImpl.setupSecurityHandlers(DeploymentManagerImpl.java:393)
at io.undertow.servlet.core.DeploymentManagerImpl.access$600(DeploymentManagerImpl.java:122)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:226)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:187)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1530)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:255)
... 10 more
2022-02-15 21:16:30,611 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "apps.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"apps.war\".undertow-deployment" => "java.lang.RuntimeException: java.lang.RuntimeException: UT010039: Unknown authentication mechanism KEYCLOAK
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: UT010039: Unknown authentication mechanism KEYCLOAK
Caused by: java.lang.RuntimeException: UT010039: Unknown authentication mechanism KEYCLOAK"}}
2022-02-15 21:16:30,757 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0010: Deployed "apps.war" (runtime-name : "apps.war")
2022-02-15 21:16:30,758 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."apps.war".undertow-deployment: java.lang.RuntimeException: java.lang.RuntimeException: UT010039: Unknown authentication mechanism KEYCLOAK
WFLYCTL0448: 1 additional services are down due to their dependencies being missing or failed
2022-02-15 22:30:23,091 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) WFLYJCA0019: Stopped Driver service with driver-name = apps.war_org.postgresql.Driver_42_2
2022-02-15 22:30:23,157 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0019: Stopped Driver service with driver-name = apps.war_org.mariadb.jdbc.Driver_2_1
2022-02-15 22:30:23,091 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0019: Stopped Driver servic22:30:23,091 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) WFLYJCA0019: Stopped Driver service with driver-name = apps.war_org.postgresql.Driver_42_2
22:30:23,157 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0019: Stopped Driver service with driver-name = apps.war_org.mariadb.jdbc.Driver_2_1
22:30:23,188 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0019: Stopped Driver service with driver-name = apps.war
22:30:23,091 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0019: Stopped Driver service with driver-name = apps.war_com.mysql.jdbc.Driver_5_1
22:30:23,091 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0019: Stopped Driver service with driver-name = apps.war_com.microsoft.sqlserver.jdbc.SQLServerDriver_8_4
e with driver-name = apps.war_com.microsoft.sqlserver.jdbc.SQLServerDriver_8_4
2022-02-15 22:30:23,091 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0019: Stopped Driver service with driver-name = apps.war_com.mysql.jdbc.Driver_5_1
2022-02-15 22:30:23,188 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0019: Stopped Driver service with driver-name = apps.war
22:30:30,455 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0028: Stopped deployment apps.war (runtime-name: apps.war) in 8182ms
22:30:30,619 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0027: Starting deployment of "apps.war" (runtime-name: "apps.war")
2022-02-15 22:30:30,455 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0028: Stopped deployment apps.war (runtime-name: apps.war) in 8182ms
2022-02-15 22:30:30,619 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0027: Starting deployment of "apps.war" (runtime-name: "apps.war")
22:30:39,265 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0003: Could not index class org/postgresql/jdbc/PgConnection$1.class at /C:/wildfly-21.0.2.Final/standalone/deployments/apps.war/WEB-INF/lib/postgresql-42.2.15.jar: java.lang.IllegalStateException: Required class information is missing
at org.jboss.jandex.Indexer.rebuildNestedType(Indexer.java:926)
at org.jboss.jandex.Indexer.resolveTypePath(Indexer.java:786)
at org.jboss.jandex.Indexer.resolveTypeAnnotation(Indexer.java:705)
at org.jboss.jandex.Indexer.resolveTypeAnnotations(Indexer.java:613)
at org.jboss.jandex.Indexer.index(Indexer.java:1602)
at org.jboss.as.server.deployment.annotation.ResourceRootIndexer.indexResourceRoot(ResourceRootIndexer.java:99)
at org.jboss.as.server.deployment.annotation.AnnotationIndexProcessor.deploy(AnnotationIndexProcessor.java:51)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
22:30:39,322 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0003: Could not index class org/postgresql/util/LruCache.class at /C:/wildfly-21.0.2.Final/standalone/deployments/apps.war/WEB-INF/lib/postgresql-42.2.15.jar: java.lang.ArrayIndexOutOfBoundsException: 1
at org.jboss.jandex.Indexer.updateTypeTarget(Indexer.java:841)
at org.jboss.jandex.Indexer.updateTypeTargets(Indexer.java:624)
at org.jboss.jandex.Indexer.index(Indexer.java:1603)
at org.jboss.as.server.deployment.annotation.ResourceRootIndexer.indexResourceRoot(ResourceRootIndexer.java:99)
at org.jboss.as.server.deployment.annotation.AnnotationIndexProcessor.deploy(AnnotationIndexProcessor.java:51)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
2022-02-15 22:30:39,265 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0003: Could not index class org/postgresql/jdbc/PgConnection$1.class at /C:/wildfly-21.0.2.Final/standalone/deployments/apps.war/WEB-INF/lib/postgresql-42.2.15.jar: java.lang.IllegalStateException: Required class information is missing
at org.jboss.jandex.Indexer.rebuildNestedType(Indexer.java:926)
at org.jboss.jandex.Indexer.resolveTypePath(Indexer.java:786)
at org.jboss.jandex.Indexer.resolveTypeAnnotation(Indexer.java:705)
at org.jboss.jandex.Indexer.resolveTypeAnnotations(Indexer.java:613)
at org.jboss.jandex.Indexer.index(Indexer.java:1602)
at org.jboss.as.server.deployment.annotation.ResourceRootIndexer.indexResourceRoot(ResourceRootIndexer.java:99)
at org.jboss.as.server.deployment.annotation.AnnotationIndexProcessor.deploy(AnnotationIndexProcessor.java:51)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)
2022-02-15 22:30:39,322 WARN [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0003: Could not index class org/postgresql/util/LruCache.class at /C:/wildfly-21.0.2.Final/standalone/deployments/apps.war/WEB-INF/lib/postgresql-42.2.15.jar: java.lang.ArrayIndexOutOfBoundsException: 1
at org.jboss.jandex.Indexer.updateTypeTarget(Indexer.java:841)
at org.jboss.jandex.Indexer.updateTypeTargets(Indexer.java:624)
at org.jboss.jandex.Indexer.index(Indexer.java:1603)
at org.jboss.as.server.deployment.annotation.ResourceRootIndexer.indexResourceRoot(ResourceRootIndexer.java:99)
at org.jboss.as.server.deployment.annotation.AnnotationIndexProcessor.deploy(AnnotationIndexProcessor.java:51)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.lang.Thread.run(Thread.java:748)

Apparently, after searching the main cause of the error, the following is that line which exist inside the error output above :

WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."apps.war".undertow-deployment: java.lang.RuntimeException: java.lang.RuntimeException: UT010039: Unknown authentication mechanism KEYCLOAK

Solution

Actually, the configuration for the keycloak feature exist in this Java Application. So, in order to make it running, one of the simple solution exist is by removing the keycloak configuration. For just an information, keycloak is an Open Source Identity and Access Management tool. It support for additinoal feature of the authentication to applications and it secure services with minimum effort. So, it will make it easy without having the application to deal for storing users or authenticating users. In general, keycloak provides user federation, strong authentication, user management, fine-grained authorization, and more. The main website for keycloak exist in this link. The following is the actual step for disabling the keycloak feature :

  1. After searching the Java application or Java program, the keycloak configuration exist in the WEB-INF folder, specifically in the web.xml file as follows :

    <login-config>
    <auth-method>KEYCLOAK</auth-method>
    <realm-name>this is ignored currently</realm-name>
    </login-config>
    
  2. Disable it by giving the comment sign as follows :
    <!--
    <login-config>
    <auth-method>KEYCLOAK</auth-method>
    <realm-name>this is ignored currently</realm-name>
    </login-config>
    -->
    
  3. Finally, just run the Java Application or Java Program again once more. The main purpose is to be able to build, to compile and to deploy it once more to the Wildfly Application Server using the modificated ‘web.xml’. If there are no more error appear, the deployment process for the Java Application or Java Program in the Wildfly Application Server will be a success.

 

Leave a Reply