When trying to deploy app with context root "/" to JBoss AS 7 / EAP 6 in default configuration, you will encounter the following.
06:46:17,324 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) 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:1767) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09-icedtea] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09-icedtea] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea] 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 at org.jboss.as.web.deployment.WebContextInjector.inject(WebContextInjector.java:57) at org.jboss.as.web.deployment.WebContextInjector.inject(WebContextInjector.java:38) at org.jboss.msc.inject.CastingInjector.inject(CastingInjector.java:55) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at org.jboss.msc.service.ServiceControllerImpl.doInject(ServiceControllerImpl.java:1549) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at org.jboss.msc.service.ServiceControllerImpl.access$1900(ServiceControllerImpl.java:49) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at org.jboss.msc.service.ServiceControllerImpl$StartTask.performInjections(ServiceControllerImpl.java:1780) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1741) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] ... 3 more
This is because AS has the root context occupied by default welcome page.
BTW, I would suggest to switch that off automatically when deploying anything with root context ("/"), and switch it off when it's undeployed... anyway:
Solution
Though Management API or CLI:
For AS 7:
/profile=default/subsystem=web/virtual-server=default-host:write-attribute(name=enable-welcome-root,value=false)
For EAP 6.1:
/subsystem=web/virtual-server=default-host/:write-attribute(name=enable-welcome-root,value=false)
You should get:
{ "outcome" => "success", "response-headers" => { "operation-requires-reload" => true, "process-state" => "reload-required" } }
Alternative way, for both:
Shut down the AS and switch it to "false" in standalone.xml.
<subsystem xmlns="urn:jboss:domain:web:1.2" default-virtual-server="default-host" native="false"> <virtual-server name="default-host" enable-welcome-root="false"> ...