我运行了以下命令: /opt/wildfly/bin/jboss-cli.sh --file /opt/wildfly/docs/examples/enable-microprofile.cli
运行上述脚本后,我收到以下成功消息:
INFO: Updating configuration to use elytron
{"outcome" => "success"}
{"outcome" => "success"}
{"outcome" => "success"}
{"outcome" => "success"}
{"outcome" => "success"}
{"outcome" => "success"}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
{
"outcome" => "success",
"response-headers" => {
"operation-requires-reload" => true,
"process-state" => "reload-required"
}
}
INFO: Removing security subsystem and ManagementRealm.
{
"outcome" => "success",
"response-headers" => {"process-state" => "reload-required"}
}
{
"outcome" => "success",
"response-headers" => {"process-state" => "reload-required"}
}
{
"outcome" => "success",
"response-headers" => {"process-state" => "reload-required"}
}
INFO: Adding microprofile subsystems.
{
"outcome" => "success",
"response-headers" => {"process-state" => "reload-required"}
}
{
"outcome" => "success",
"response-headers" => {"process-state" => "reload-required"}
}
INFO: microprofile-jwt-smallrye already in configuration, subsystem not added.
{
"outcome" => "success",
"response-headers" => {"process-state" => "reload-required"}
}
{
"outcome" => "success",
"response-headers" => {"process-state" => "reload-required"}
}
INFO: Configuration done.
现在启动 JBoss 时出现以下错误。主要错误是 ELY01148:SecurityDomain 已与指定的 ClassLoader 关联。
geonames-service_1 | 13:54:28,929 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."geonames-service-1.0-snapshot.war".undertow-deployment.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.deployment.unit."geonames-service-1.0-snapshot.war".undertow-deployment.UndertowDeploymentInfoService: Failed to start service
geonames-service_1 | at [email protected]//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1731)
geonames-service_1 | at [email protected]//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
geonames-service_1 | at [email protected]//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
geonames-service_1 | at [email protected]//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
geonames-service_1 | at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
geonames-service_1 | at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1363)
geonames-service_1 | at java.base/java.lang.Thread.run(Thread.java:834)
geonames-service_1 | Caused by: java.lang.IllegalStateException: ELY01148: A SecurityDomain has already been associated with the specified ClassLoader
geonames-service_1 | at [email protected]//org.wildfly.security.auth.server.SecurityDomain.registerWithClassLoader(SecurityDomain.java:150)
geonames-service_1 | at org.wildfly.security.elytron-web.undertow-server-servlet@1.7.1.Final//org.wildfly.elytron.web.undertow.server.servlet.AuthenticationManager.configure(AuthenticationManager.java:91)
geonames-service_1 | at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.applyElytronSecurity(UndertowDeploymentInfoService.java:1242)
geonames-service_1 | at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:957)
geonames-service_1 | at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:276)
geonames-service_1 | at [email protected]//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
geonames-service_1 | at [email protected]//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
geonames-service_1 | ... 6 more
geonames-service_1 |
geonames-service_1 | 13:54:28,939 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "geonames-service-1.0-snapshot.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"geonames-service-1.0-snapshot.war\".undertow-deployment.UndertowDeploymentInfoService" => "Failed to start service
geonames-service_1 | Caused by: java.lang.IllegalStateException: ELY01148: A SecurityDomain has already been associated with the specified ClassLoader"}}
geonames-service_1 | 13:54:29,079 INFO [org.jboss.as.server] (ServerService Thread Pool -- 46) WFLYSRV0010: Deployed "geonames-service-1.0-snapshot.war" (runtime-name : "geonames-service-1.0-snapshot.war")
geonames-service_1 | 13:54:29,090 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
geonames-service_1 | WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."geonames-service-1.0-snapshot.war".undertow-deployment.UndertowDeploymentInfoService: Failed to start service
geonames-service_1 | WFLYCTL0448: 19 additional services are down due to their dependencies being missing or failed
geonames-service_1 | 13:54:29,220 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
geonames-service_1 | 13:54:29,222 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 20.0.0.Final (WildFly Core 12.0.1.Final) started (with errors) in 19167ms - Started 440 of 779 services (22 services failed or missing dependencies, 464 services are lazy, passive or on-demand)
geonames-service_1 | 13:54:29,234 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://0.0.0.0:9990/management
geonames-service_1 | 13:54:29,234 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://0.0.0.0:9990
请提供任何建议。
在快速入门之后,我使用 Wildfly 25 和(使用 Elytron 1.17.1)使用 BEARER_TOKEN 作为登录机制得到了相同的异常:https://github.com/wildfly/quickstart/tree/main/jaxrs-jwt
问题的发生是因为我使用 EJB 并且 ReST Endpoint 对于我的战争有不同的 SecurityDomain。
我将安全域切换为jwt-domain,如下所示:
<subsystem xmlns="urn:jboss:domain:ejb3:9.0">
...
<application-security-domain name="other" security-domain="jwt-domain"/>