July 8, 2016

JBoss 6 root context

Suppose you have an application (say named example) deployed in JBoss 6.
By default your application will be accessed by <Your URL>/example.

Suppose you want to make the application available at <Your URL> i.e the root location.
Then follow the following 2 steps:

1. Change the context of the ROOT.war application

To do that, create a file named jboss-web.xml  under <base folder>/jboss-6.1.0.Final/server/default/deploy/ROOT.war/WEB-INF.

<?xml version="1.0"?>

<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">

<jboss-web>
<context-root>root</context-root>
</jboss-web>

2. Add a jboss-web.xml  under WEB-INF of your application
<?xml version="1.0"?>

<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">

<jboss-web>
<context-root>/</context-root>
</jboss-web>

Now running <Your URL> in a browser will point to your example application.

No comments:

Post a Comment