Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Open the geronimo-web.xml file and edit the artifactId and context-root to make this deployment unique. Within the web-app section add the host attribute and specify the Virtual Host you want this application to listen, in this case virtualhost1.com.

Code Block
xml
xml
borderStylesolid
titlegeronimo-web.xml for HelloWorld_1
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1">
    <environment>
        <moduleId>
            <groupId>sample.applications</groupId>
            <artifactId>HelloWorldApp_1</artifactId>
            <version>1.1</version>
        </moduleId>		
    </environment>
    <context-root>/hello<hello_1</context-root>
    <host>virtualhost1.com</host>
</web-app>

Save the changed to the geronimo-web.xml file and generate a WAR file by typing the following command from the <app_home> directory:

jar -cvf HelloWorld_1.war *

Once deployed this application should only listed in the virtualhost1.com host name.

We will now repeat this steps to create a second WAR. Edit once again the geronimo-web.xml file and copy the content form the following example. Note that we are only changing the artifactId, context-root and host.

Code Block
xml
xml
borderStylesolid
titlegeronimo-web.xml for HelloWorld_2

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1">
    <environment>
        <moduleId>
            <groupId>sample.applications</groupId>
            <artifactId>HelloWorldApp_2</artifactId>
            <version>1.1</version>
        </moduleId>		
    </environment>
    <context-root>/hello_2</context-root>
    <host>virtualhost1.com</host>
</web-app>

Save the changed to the geronimo-web.xml file and generate a second WAR file by typing the following command from the <app_home> directory:

jar -cvf HelloWorld_2.war *

You now have two applications ready to be deployed to two different virtual hosts.

Back to Top

Deploy the application

...