JBoss Default Application Archive

Changing default application in Jboss

The below post describes how we can change the default application deployed on the Jboss Server and changing the default ports to access the same.

By Default when a Jboss Server is started, it would deploy the ROOT.war file present in the $JBOSS_HOME/server/$PROFILE/deploy folder.

Hence when you access http://localhost:8080/ , it loads the default index page as below.

There could be scenarios, where you would like to customize this configuration and might want to deploy a custom application as a default application.

Steps to change the default application.

*******************************************************

1. Change the context-root for ROOT.war

By default, the web context root for the ROOT.war file is ‘/’, hence this application is picked up as the default  one.         Create a jboss-web.xml , with a new context root other than ‘/’ under $JBOSS_HOME/server/ $PROFILE/ deploy/ROOT.war/WEB-INF  folder.

<jboss-web>

<context-root>/root</context-root>

</jboss-web>

Now the ROOT.war file is available at http://localhost:8080/root/

2. Define context-root of custom application as ‘/’

In WEB-INF folder of your application, add a jboss-web.xml file with context-root as ‘/’.

A sample jboss-web.xml file would look like.

<?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>

Now your custom application is available at http://localhost:8080/

Changing the default Jboss Web Server port from 8080

*******************************************************

By default, the Jboss Web Server runs on port 8080. Hence you need to specify the port while accessing the default application.

However we can change the default port of 8080 to HTTP port which is 80.

This port 8080 is defined in the  bindings-jboss-beans.xml file present under the $JBOSS_HOME/server/$PROFILE/ conf/bindingservice.beans/META-INF/ folder.

The port entry looks like below

<bean>

<property name="serviceName">jboss.web:service=WebServer</property>

<property name="port">8080</property>

<property name="description">JBoss Web HTTP connector socket; also drives the values for the HTTPS and AJP sockets</property>

Modify the port to 80.

Re-start the server and access your application at  http://localhost/ or any domain names  for example http://abc.com/

For further reading:

http://docs.redhat.com/docs/en-US/JBoss_Enterprise_Web_Platform/5/html/Getting_Started_Guide/The_JBoss_Server___A_Quick_Tour-Basic_Configuration_Issues.html

Cheers,

Wonders Team.:)