I have a problem. I have two web apps deployed as wars. Let's call them app1.war and app2.war.

I would like app1.war to be accessed at the URL www.website.com and I would like app2.war to be accessible as www.website.com/anotherapp. I have my domain name ready.

Virtual hosting does not seem to help here.

I am running JBoss App Server 5.1 and Seam 2.2.0. I am working on integrating a forum (deployed as a war) with my app (deployed as another war) and therefore need to use single sign on and therefore would like the URL formats described above for easy passing of sso cookies.

Thanks for any insights.

-Charles.

Accepted Answer

You need to do such things:

  1. Configure your JBoss to use virtual host with the www.website.com name.

    You can do it by editing server.xml from jbossweb.sar directory. In short you have to set up another Host directive.

  2. You have to setup your war application. You can do it by creating or editing jboss-web.xml file (it should be placed in WEB-INF directory). In that file you can configure what virtual host should be used and under what context.

Example of that file for app1.war

<jboss-web>
   <context-root>/</context-root>
   <virtual-host>website</virtual-host>
</jboss-web>

Example of that file for app2.war

<jboss-web>
   <context-root>/anotherapp</context-root>
   <virtual-host>website</virtual-host>
</jboss-web>

More info you can find in that post Hosting Multiple Domains With JBoss

Written by Lukasz Stelmach
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki