ELY01148: A SecurityDomain has already been associated with the specified ClassLoader in JBoss EAP 7

Solution Verified - Updated -

Issue

  • Application failing to deploy with ELY01148: A SecurityDomain has already been associated with the specified ClassLoader in JBoss EAP 7.4
13:12:25,181 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."simple-webapp.war".undertow-deployment.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.deployment.unit."simple-webapp.war".undertow-deployment.UndertowDeploymentInfoService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1731)
    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:1982)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1363)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: ELY01148: A SecurityDomain has already been associated with the specified ClassLoader
    at org.wildfly.security.auth.server.SecurityDomain.registerWithClassLoader(SecurityDomain.java:148)
    at org.wildfly.elytron.web.undertow.server.servlet.AuthenticationManager.configure(AuthenticationManager.java:91)
    at org.wildfly.extension.undertow.ApplicationSecurityDomainDefinition$ApplicationSecurityDomainService.apply(ApplicationSecurityDomainDefinition.java:476)
    at org.wildfly.extension.undertow.ApplicationSecurityDomainDefinition$ApplicationSecurityDomainService.apply(ApplicationSecurityDomainDefinition.java:410)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.applyElytronSecurity(UndertowDeploymentInfoService.java:1229)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:957)
    at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:276)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
    ... 6 more
  • EAP XP 3 Bootable jar using ejb layer and RH SSO keycloak-client-oidc such as :
                        <layer>web-server</layer>
                        <layer>ejb</layer>
                        <layer>keycloak-client-oidc</layer>

Fails to start with:

...
Caused by: java.lang.IllegalStateException: ELY01148: A SecurityDomain has already been associated with the specified ClassLoader
    at org.wildfly.security.auth.server.SecurityDomain.registerWithClassLoader(SecurityDomain.java:148)
    at org.wildfly.elytron.web.undertow.server.servlet.AuthenticationManager.configure(AuthenticationManager.java:91)
...

Environment

Red Hat Enterprise Application Platform (EAP) 7
Red Hat Enterprise Application Platform expansion pack (EAPXP) 3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content