When you build your EAR, in application EAR you have to tell jboss that context path starts from root:
application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/application_5.xsd"
version="5">
<display-name>MyApp</display-name>
<module>
<web>
<web-uri>myweb.war</web-uri>
<context-root>/</context-root>
</web>
</module>
</application>
Then you have to include in your WAR a special file for jboss which will contain
mapping between your web application and virtual host for jboss tomcat:
META-INF/jboss-web.xml
<jboss-web>
<context-root>/</context-root> <!--Make what ever context root you want -->
<virtual-host>mywebhost1</virtual-host>
</jboss-web>
Final step is to tell tomcat inside jboss that you have multiple virtual hosts and map each of them to real domain names.
Add corresponding <Host> tags:
jboss-4.0.4.GA\server\default\deploy\jbossweb-tomcat55.sar\server.xml
<Server>
<...>
<Service name="jboss.web"
className="org.jboss.web.tomcat.tc5.StandardService">
<!-- A AJP 1.3 Connector on port 8009 -->
<Connector port="8009" address="${jboss.bind.address}"
emptySessionPath="true" enableLookups="false" redirectPort="8443"
protocol="AJP/1.3"/>
<Engine name="jboss.web" defaultHost="localhost">
<Host name="localhost"
autoDeploy="false" deployOnStartup="false" deployXML="false">
<Host name="mywebhost1"
autoDeploy="false" deployOnStartup="false" deployXML="false">
<Alias>mydomain1.com</Alias>
<Alias>www.mydomain1.com</Alias>
</Host>
</Engine>
</Service>
</Server>
For all ears create vurtual hosts like mywebhost1, mywebhost2 ... and then map virtual hosts to real aliases.