JBoss: JBAS018038: Root contexts can not be deployed when the virtual host configuration has the welcome root enabled

Автор: | 01/19/2016
 

JBoss_logoПосле деплоя ROOT.warJBoss сообщает об ошибке:

09:10:07,656 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.web.deployment.default-host./ROOT: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./ROOT: Failed to start service
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1936) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_91]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_91]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_91]
Caused by: java.lang.IllegalStateException: JBAS018038: Root contexts can not be deployed when the virtual host configuration has the welcome root enabled, disable it and redeploy
...

Для решения — необходимо изменить параметр enable-welcome-root.

Вариант 1 — с помощью JBoss CLI

Подключаемся:

# ./bin/jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect
[standalone@localhost:9999 /]

Выполняем:

[standalone@localhost:9999 /] /subsystem=web/virtual-server=default-host:write-attribute(name=enable-welcome-root,value=false)
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}

Вариант 2 — в файле standalone.xml

Другой вариант — вручную изменить значение enable-welcome-root на False в файле ${JBOSS_HOME}/standalone/configuration/standalone.xml:

        <subsystem xmlns="urn:jboss:domain:web:2.1" default-virtual-server="default-host" native="false">
       ...
            <virtual-server name="default-host" enable-welcome-root="false">
       ...

Перезагружаем JBoss:

# service jboss restart
 * Stopping JBoss Application Server jboss                                                                                                                                                         [ OK ]
 * Starting JBoss Application Server jboss

Проверяем:

...
09:20:04,704 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "ROOT.war" (runtime-name: "ROOT.war")
09:20:04,732 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss/standalone/deployments
09:20:04,752 INFO  [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on 0.0.0.0:4447
09:20:05,358 INFO  [org.jboss.web] (ServerService Thread Pool -- 53) JBAS018210: Register web context:
09:20:06,083 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "ROOT.war" (runtime-name : "ROOT.war")
...

Готово.