Versions Compared

Key

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

...

As mentioned before, for this example we are using the HelloWorld sample application covered in the Quick start - Apache Geronimo for the impatient section. Since this is a Web application, the deployment plan that we will be modifying would be are modifying is the geronimo-web.xml. If you use a different type of application you may need to modify a different deployment plan, for example geronimo-application.xml. Refer to Deployment plans for further details-application.xml. Refer to Deployment plans for further details.

In the previous section we defined two Virtual Hosts, now we will be configuring two applications so they can be deployed to those Virtual Hosts exclusively.

We will use the same application in both cases but will differenciate one deployment from the other by giving it a different artifactId, this way we avoid modifying the code but still can identify each deployment.

Assuming you followed the steps covered in the Quick start - Apache Geronimo for the impatient section you should have the following structure:

No Format

<app_home>\
          + HelloWorld.jsp
          + WEB-INF\
                    + geronimo-web.xml
                    + web.xml

Open the geronimo-web.xml file and edit the artifactId 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</context-root>
    <host>virtualhost1.com</host>
</web-app>

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

jar -cvf HelloWorld_1.war *

Back to Top

Deploy the application

...