org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./: 启动服务失败

org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./: Failed to start service

这应该是大家部署的时候都会遇到的很普遍的问题。如果您在 / 上下文下部署网络存档 (.war),您将失败。

JBoss console 中的错误是这样的,

Internal Server Error { "outcome" => "failed", "failure-description" => {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./: Failed to start service Caused by: java.lang.IllegalArgumentException: JBWEB000250: Child container with name already exists"}}, "rolled-back" => true }

问题是因为standalone.xml

中的如下配置
<subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <virtual-server name="default-host" enable-welcome-root="true">
                <alias name="localhost"/>
                <alias name="example.com"/>
            </virtual-server>
</subsystem>

要解决此问题,

enable-welcome-root="true"待制作"false"

<subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <virtual-server name="default-host" enable-welcome-root="false">
                <alias name="localhost"/>
                <alias name="example.com"/>
            </virtual-server>
</subsystem>