Set Context Root for a JavaEE 6 Application with JBoss 7.1

Per default, a Web Application which is packaged as a WAR file is mapped to „http://jbossurl:port/war_file_name“ when deployed to JBoss AS 7.1. We wanted the application to be mapped to the root context instead of the file name. It turns out, that this is pretty easy to achieve:

  1. Edit standalone.xml in the JBoss configuration directory. Edit the relevant part of the file like this:
    <subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host">
        <connector name="http" protocol="HTTP/1.1" socket-binding="http" scheme="http"/>
        <virtual-server name="default-host" enable-welcome-root="false">

    The important part is the enable-welcome-root=“false“.

  2. Create a file „jboss-web.xml“ in the WEB-INF folder of your application.
  3. Add the following to the file:

    <?xml version="1.0" encoding="UTF-8"?>

Now your Application will be mapped to the context-root of the Application Server and should be accessible with „http://jbossurl:port“.