无法加载模块 org.keycloak.keycloak-server-subsystem

Failed to load module org.keycloak.keycloak-server-subsystem

启动从官方网站下载的 Keycloak demo v3.2.1.Final 时出现以下错误:

22:56:46,404 INFO  [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
22:56:46,590 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
22:56:46,675 INFO  [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting
22:56:47,309 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration
    at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:131)
    at org.jboss.as.server.ServerService.boot(ServerService.java:356)
    at org.jboss.as.controller.AbstractControllerService.run(AbstractControllerService.java:299)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.xml.stream.XMLStreamException: WFLYCTL0083: Failed to load module org.keycloak.keycloak-server-subsystem
    at org.jboss.as.controller.parsing.ExtensionXml.parseExtensions(ExtensionXml.java:155)
    at org.jboss.as.server.parsing.StandaloneXml$DefaultExtensionHandler.parseExtensions(StandaloneXml.java:126)
    at org.jboss.as.server.parsing.StandaloneXml_4.readServerElement(StandaloneXml_4.java:218)
    at org.jboss.as.server.parsing.StandaloneXml_4.readElement(StandaloneXml_4.java:141)
    at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:103)
    at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:49)
    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
    at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
    at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123)
    ... 3 more
Caused by: java.util.concurrent.ExecutionException: javax.xml.stream.XMLStreamException: WFLYCTL0083: Failed to load module
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.jboss.as.controller.parsing.ExtensionXml.parseExtensions(ExtensionXml.java:147)
    ... 11 more
Caused by: javax.xml.stream.XMLStreamException: WFLYCTL0083: Failed to load module
    at org.jboss.as.controller.parsing.ExtensionXml.loadModule(ExtensionXml.java:196)
    at org.jboss.as.controller.parsing.ExtensionXml.access[=11=]0(ExtensionXml.java:69)
    at org.jboss.as.controller.parsing.ExtensionXml.call(ExtensionXml.java:127)
    at org.jboss.as.controller.parsing.ExtensionXml.call(ExtensionXml.java:124)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: org.jboss.modules.ModuleNotFoundException: org.keycloak.keycloak-server-subsystem:main
    at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:223)
    at org.jboss.as.controller.parsing.ExtensionXml.loadModule(ExtensionXml.java:178)
    ... 8 more

为了解决这个问题,我在 keycloak-demo-3.2.1.Final/keycloak/modules 中创建了一个名为 layers.conf 的文件,其中只有一行:

layers=keycloak