java Wildfly 8 意外元素“{urn:jboss:domain:web:1.1}subsystem”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28236694/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 13:14:52  来源:igfitidea点击:

Wildfly 8 Unexpected element '{urn:jboss:domain:web:1.1}subsystem'

javajbosswildflywildfly-8keycloak

提问by Passionate Engineer

I'm getting below error when I start Keycloak service:

启动 Keycloak 服务时出现以下错误:

0:09:08,028 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
00:09:08,268 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
00:09:08,348 INFO  [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.1.0.Final "Kenny" starting
00:09:08,985 ERROR [org.jboss.as.server] (Controller Boot Thread) JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration
    at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:112) [wildfly-controller-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.ServerService.boot(ServerService.java:331) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.controller.AbstractControllerService.run(AbstractControllerService.java:256) [wildfly-controller-8.1.0.Final.jar:8.1.0.Final]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[94,9]
Message: Unexpected element '{urn:jboss:domain:web:1.1}subsystem'
    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:108) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
    at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
    at org.jboss.as.server.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:1131) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_4(StandaloneXml.java:458) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:145) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:107) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
    at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
    at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:104) [wildfly-controller-8.1.0.Final.jar:8.1.0.Final]
    ... 3 more

00:09:08,989 FATAL [org.jboss.as.server] (Controller Boot Thread) JBAS015957: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
00:09:09,004 INFO  [org.jboss.as] (MSC service thread 1-2) JBAS015950: WildFly 8.1.0.Final "Kenny" stopped in 4ms

In standalone.xml I have below setup:

在 standalone.xml 我有以下设置:

 <profile>
        <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"  redirect-port="443" />
            <connector name="https" scheme="https" protocol="HTTP/1.1" socket-binding="https"
                       enable-lookups="false" secure="true">
                <ssl name="localhost-ssl" password="secret" protocol="TLSv1"
                     key-alias="localhost" certificate-key-file="${jboss.server.config.dir}/keycloak.jks" />
            </connector>
        </subsystem>

I followed the instructions on thislink but it doesn't seem to work with above error.

我按照链接上的说明进行操作,但似乎无法解决上述错误。

Is there something that needs to be done that is missing here?

有什么需要做的事情吗?

Update

更新

I've changed to what was suggested but now getting below error:

我已更改为建议的内容,但现在出现以下错误:

02:20:43,434 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("add") failed - address: ([("subsystem" => "webservices")]) - failure description: {"JBAS014879: One or more services were unable to start due to one or more indirect dependencies not being available." => {
    "Services that were unable to start:" => ["jboss.ws.config"],
    "Services that may be the cause:" => [
        "jboss.deployment.unit.\"oauth-client-cdi.war\".beanmanager",
        "jboss.server.controller.management.security_realm.UndertowRealm"
    ]
}}

回答by Federico Sierra

The XML namespace urn:jboss:domain:web:1.1is for AS7. The correct namespace in WildFly for web subsystem is urn:jboss:domain:undertow:1.0:

XML 命名空间urn:jboss:domain:web:1.1适用于 AS7。WildFly 中用于 web 子系统的正确命名空间是urn:jboss:domain:undertow:1.0

<security-realms>
    ...
    <security-realm name="SecureRealm">
        <server-identities>
            <ssl>
                <keystore path="localhost.keystore" relative-to="jboss.server.config.dir" keystore-password="wildfly"/>
            </ssl>
        </server-identities>
    </security-realm>
</security-realms>
...
<subsystem xmlns="urn:jboss:domain:undertow:1.0">
    ...
    <server name="default-server">
        <http-listener name="default" socket-binding="http"/>
        <https-listener name="https" socket-binding="https" security-realm="SecureRealm"/>
        <host name="default-host" alias="localhost">
            <location name="/" handler="welcome-content"/>
            <filter-ref name="server-header"/>
            <filter-ref name="x-powered-by-header"/>
        </host>
    </server>
    ...
</subsystem>

You can find a full example in http://reallifejava.com/configuring-ssl-in-wildfly-8/

您可以在http://reallifejava.com/configuring-ssl-in-wildfly-8/ 中找到完整示例