How to deploy to JBoss AS7 default ROOT context

If you want to deploy your app to the default ROOT context of JBoss AS7, you have to modify first your standalone.xml. Otherwise, you will raise this exception :

Caused by: java.lang.IllegalArgumentException: Child container with name already exists

By default, AS7 has an application already deployed to / context.

To fix this, set your enable-welcome-root="true" to enable-welcome-root="false". Which finaly gives you :

<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"/>
   <virtual-server name="default-host" enable-welcome-root="false">
      <alias name="localhost"/>
      <alias name="example.com"/>
   </virtual-server>
</subsystem>


That’s all 😉