Creating Virtual Hosts on JBoss

Create an application having the virtual host element in the jboss-web.xml present in the WEB-INF folder of the applicatio

jboss-web.xml

<?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>/VhostApp</context-root>
<virtual-host>virtual.bea.com</virtual-host>
</jboss-web>

In the server.xml present inĀ C:JBossjboss-5.1.0.CR1serveralldeployjbossweb.sar
create a virtual host

server.xml

<Host name="virtual"> 
<Alias>virtual.bea.com</Alias>
<Valve className="org.jboss.web.tomcat.service.jca.CachedConnectionValve"
cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager"
transactionManagerObjectName="jboss:service=TransactionManager" /> 
</Host>

Map the host name with the ip in the hosts file

C:WINDOWSsystem32driversetc

192.168.96.88 virtual.bea.com

Access the application using the virtual host and port!