Versions Compared

Key

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

Wiki Markup
{scrollbar}
Excerpt

This article shows how to configure Virtual Hosts in Apache Geronimo with Tomcat.

By default, when you deploy and start an application in Geronimo, that application will be listening on every available host name. By configuring a virtual host you can make an application listen on a specific host name or IP. The configuration steps described in this article are also valid when you are sharing a single IP among several host names.
To configure a virtual host in Geronimo you basically need to:

...

For this example we will be using the following host names defined in the local host table:

127.0.0.1 localhost virtualhost1.com virtualhost2.com virtualhost3.com virtualhost4.com

Make sure your system can resolve these names.

...

Code Block
xml
xml
borderStylesolid
titleExcerpt from config.xml
...
<gbean gbeanInfo="org.apache.geronimo.tomcat.HostGBean" 
        name="org.apache.geronimo.configs/tomcat6/2.1/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.1/car,j2eeType=Host,name=TomcatVirtualHost_1">
    <attribute name="className">org.apache.catalina.core.StandardHost</attribute>
    <attribute name="initParams">name=virtualhost1.com
       appBase=
       workDir=work</attribute>    <reference name="Engine">
        <pattern>
            <name>TomcatEngine</name>
        </pattern>
    </reference>
</gbean>
...

To add the second HostGBean TomcatVirtualHost_2 add the following lines right after the first HostGBean. These two HostGBeans have been split so it is easier to identify them. The main difference between these two is the <attribute name="aliases">..,..</attribute> line to define the aliases.

Code Block
xml
xml
borderStylesolid
titleExcerpt from config.xml
...
<gbean gbeanInfo="org.apache.geronimo.tomcat.HostGBean"
       name="org.apache.geronimo.configs/tomcat6/2.1/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.1/car,j2eeType=Host,name=TomcatVirtualHost_2">
    <attribute name="className">org.apache.catalina.core.StandardHost</attribute>
    <attribute name="initParams">name=virtualhost2.com
       appBase=
       workDir=work</attribute>
       <attribute name="aliases">virtualhost3.com,virtualhost4.com</attribute>
</gbean>
...
    <reference name="Engine">
        <pattern>
            <name>TomcatEngine</name>
        </pattern>
    </reference>
</gbean>
...

At this point you have successfully configured two different virtual hosts in Geronimo. Make sure you save the changes to the config.xml file and start Geronimo.

For additional reference, this is an excerpt from config.xml of the entire <module name="org.apache.geronimo.configs/tomcat6/2.1/car"> entry with the two HostGBean already defined.

Code Block
xml
xml
borderStylesolid
titleconfig.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<attributes xmlns:ns2="http://geronimo.apache.org/xml/ns/plugins-1.3" xmlns="http://geronimo.apache.org/xml/ns/attributes-1.2">
    <comment>
==================================================================
Warning - This XML file is regenerated by Geronimo whenever
changes are made to Geronimo's configuration.

If you want to include comments, create a single comment element
element.  They are allowable at any level of the configuration.

!!!! Do not edit this file while Geronimo is running !!!!
==================================================================</comment>
    <module name="org.apache.geronimo.framework/j2ee-security/2.1/car">
        <gbean name="JMXService">
            <attribute name="protocol">rmi</attribute>
            <attribute name="host">${ServerHostname}</attribute>
            <attribute name="port">${JMXPort + PortOffset}</attribute>
            <attribute name="urlPath">/jndi/rmi://${ServerHostname}:${NamingPort + PortOffset}/JMXConnector</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.framework/rmi-naming/2.1/car">
        <gbean name="RMIRegistry">
            <attribute name="port">${NamingPort + PortOffset}</attribute>
        </gbean>
        <gbean name="NamingProperties">
            <attribute name="namingProviderUrl">rmi://${ServerHostname}:${NamingPort + PortOffset}</attribute>
        </gbean>
        <gbean name="DefaultThreadPool">
            <attribute name="keepAliveTime">30000</attribute>
            <attribute name="minPoolSize">${MinThreadPoolSize}</attribute>
            <attribute name="maxPoolSize">${MaxThreadPoolSize}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.framework/j2ee-system/2.1/car"/>
    <module name="org.apache.geronimo.framework/jee-specs/2.1/car"/>
    <module name="org.apache.geronimo.framework/shutdown/2.1/car" load="false"/>
    <module name="org.apache.geronimo.framework/client-system/2.1/car" load="false"/>
    <module name="org.apache.geronimo.framework/online-deployer/2.1/car" load="false"/>
    <module name="org.apache.geronimo.framework/transformer-agent/2.1/car"/>
    <module name="org.apache.geronimo.framework/server-security-config/2.1/car"/>
    <module name="org.apache.geronimo.framework/plugin/2.1/car">
        <gbean name="DownloadedPluginRepos">
            <attribute name="repositoryList">http://geronimo.apache.org/plugins/plugin-repository-list-2.1.txt</attribute>
            <attribute name="userRepositories">~/.m2/repository</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.framework/xmlbeans/2.1/car"/>
    <module name="org.apache.geronimo.configs/myfaces-deployer/2.1/car"/>
    <module name="org.apache.geronimo.configs/myfaces/2.1/car"/>
    <module name="org.apache.geronimo.configs/j2ee-server/2.1/car"/>
    <module name="org.apache.geronimo.configs/j2ee-deployer/2.1/car">
        <gbean name="WebBuilder">
            <attribute name="defaultNamespace">http://geronimo.apache.org/xml/ns/j2ee/web/jetty-2.0</attribute>
        </gbean>
        <gbean name="EnvironmentEntryBuilder">
            <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee,http://java.sun.com/xml/ns/javaee</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.framework/geronimo-gbean-deployer/2.1/car">
        <gbean name="Deployer">
            <attribute name="remoteDeployAddress">http://${RemoteDeployHostname}:${HTTPPort + PortOffset}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/activemq-ra/2.1/car">
        <gbean name="ActiveMQ RA">
            <attribute name="ServerUrl">tcp://${ServerHostname}:${ActiveMQPort + PortOffset}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/activemq-broker/2.1/car">
        <gbean name="ActiveMQ.tcp.default">
            <attribute name="host">${ServerHostname}</attribute>
            <attribute name="port">${ActiveMQPort + PortOffset}</attribute>
        </gbean>
        <gbean name="ActiveMQ.stomp.default">
            <attribute name="host">${ServerHostname}</attribute>
            <attribute name="port">${ActiveMQStompPort + PortOffset}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/system-database/2.1/car">
        <gbean name="DerbyNetwork">
            <attribute name="host">${ServerHostname}</attribute>
            <attribute name="port">${DerbyPort + PortOffset}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/transaction/2.1/car">
        <gbean name="ResourceBindings">
            <attribute name="format">${ResourceBindingsFormat}</attribute>
            <attribute name="nameInNamespace">${ResourceBindingsNameInNamespace}</attribute>
            <attribute name="namePattern">${ResourceBindingsNamePattern}</attribute>
            <attribute name="abstractNameQuery">${ResourceBindingsQuery}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/uddi-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.configs/axis/2.1/car"/>
    <module name="org.apache.geronimo.configs/webservices-common/2.1/car"/>
    <module name="org.apache.geronimo.configs/openejb/2.1/car">
        <gbean name="EJBNetworkService">
            <attribute name="port">${OpenEJBPort + PortOffset}</attribute>
            <attribute name="host">${ServerHostname}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/openjpa/2.1/car"/>
    <module name="org.apache.geronimo.configs/jasper/2.1/car"/>
    <module name="org.apache.geronimo.configs/tomcat6/2.1/car">

        <!-- Virtual Host 1 definition -->
        <gbean name="org.apache.geronimo.configs/tomcat6/2.1/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.1/car,
        j2eeType=Host,name=TomcatVirtualHost_1" gbeanInfo="org.apache.geronimo.tomcat.HostGBean">
            <attribute name="className">org.apache.catalina.core.StandardHost</attribute>
            <attribute name="initParams">name=virtualhost1.com
			                 appBase=
                                         workDir=work</attribute>
        </gbean>

     <reference name="Engine">
                <pattern>
          <!-- Virtual Host 2 and aliases definition -->
            <name>TomcatEngine</name>
          <gbean name="org.apache.geronimo.configs/tomcat6/2      </pattern>
           </reference>        </gbean>

        <!-- Virtual Host 2 and aliases definition -->
        <gbean name="org.apache.geronimo.configs/tomcat6/2.1/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.1/car,
        j2eeType=Host,name=TomcatVirtualHost_2" gbeanInfo="org.apache.geronimo.tomcat.HostGBean">" gbeanInfo="org.apache.geronimo.tomcat.HostGBean">
            <attribute name="className">org.apache.catalina.core.StandardHost</attribute>
            <attribute name="initParams">name=virtualhost2.com
			                 appBase=
                                         workDir=work</attribute>
            <attribute name="classNamealiases">org>virtualhost3.apache.catalina.core.StandardHost<com,virtualhost4.com</attribute>
            <attribute<reference name="initParams">name=virtualhost2.com
			Engine">
                 appBase=<pattern>
                    <name>TomcatEngine</name>
                </pattern>
         workDir=work</attribute>
    </reference>        <attribute name="aliases">virtualhost3.com,virtualhost4.com</attribute>
        </gbean>


        <gbean name="TomcatWebConnector">
            <attribute name="host">${ServerHostname}</attribute>
            <attribute name="port">${HTTPPort + PortOffset}</attribute>
            <attribute name="redirectPort">${HTTPSPort + PortOffset}</attribute>
            <attribute name="maxHttpHeaderSize">8192</attribute>
            <attribute name="maxThreads">150</attribute>
            <attribute name="minSpareThreads">25</attribute>
            <attribute name="maxSpareThreads">75</attribute>
            <attribute name="enableLookups">false</attribute>
            <attribute name="acceptCount">100</attribute>
            <attribute name="connectionTimeout">${WebConnectorConTimeout}</attribute>
            <attribute name="disableUploadTimeout">true</attribute>
        </gbean>
        <gbean name="TomcatAJPConnector">
            <attribute name="host">${ServerHostname}</attribute>
            <attribute name="port">${AJPPort + PortOffset}</attribute>
            <attribute name="redirectPort">${HTTPSPort + PortOffset}</attribute>
            <attribute name="minSpareThreads">25</attribute>
            <attribute name="maxSpareThreads">75</attribute>
            <attribute name="enableLookups">false</attribute>
        </gbean>
        <gbean name="TomcatWebSSLConnector">
            <attribute name="host">${ServerHostname}</attribute>
            <attribute name="port">${HTTPSPort + PortOffset}</attribute>
            <attribute name="maxHttpHeaderSize">8192</attribute>
            <attribute name="maxThreads">150</attribute>
            <attribute name="minSpareThreads">25</attribute>
            <attribute name="maxSpareThreads">75</attribute>
            <attribute name="enableLookups">false</attribute>
            <attribute name="acceptCount">100</attribute>
            <attribute name="disableUploadTimeout">false</attribute>
            <attribute name="clientAuth">false</attribute>
            <attribute name="algorithm">Default</attribute>
            <attribute name="sslProtocol">TLS</attribute>
            <attribute name="keystoreFile">var/security/keystores/geronimo-default</attribute>
            <attribute name="keystorePass">secret</attribute>
            <attribute name="keystoreType">JKS</attribute>
        </gbean>
        <gbean name="TomcatHost">
            <attribute name="initParams">name=${ServerHostname}
                                        appBase=
                                        workDir=work</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/connector-deployer/2.1/car">
        <gbean name="ResourceRefBuilder">
            <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee,http://java.sun.com/xml/ns/javaee</attribute>
            <attribute propertyEditor="org.apache.geronimo.deployment.service.EnvironmentBuilder" name="corbaEnvironment">
                <environment:environment xmlns:environment="http://geronimo.apache.org/xml/ns/deployment-1.2">
                    <environment:dependencies>
                        <environment:dependency>
                            <environment:groupId>org.apache.geronimo.configs</environment:groupId>
                            <environment:artifactId>j2ee-corba-yoko</environment:artifactId>
                            <environment:type>car</environment:type>
            </environment:dependency>
          </environment:dependencies>
        </environment:environment></attribute>
        </gbean>
        <gbean name="AdminObjectRefBuilder">
            <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee,http://java.sun.com/xml/ns/javaee</attribute>
        </gbean>
        <gbean name="ClientResourceRefBuilder">
            <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee,http://java.sun.com/xml/ns/javaee</attribute>
            <attribute propertyEditor="org.apache.geronimo.deployment.service.EnvironmentBuilder" name="corbaEnvironment">
                <environment:environment xmlns:environment="http://geronimo.apache.org/xml/ns/deployment-1.2">
                    <environment:dependencies>
                        <environment:dependency>
                            <environment:groupId>org.apache.geronimo.configs</environment:groupId>
                            <environment:artifactId>client-corba-yoko</environment:artifactId>
                            <environment:type>car</environment:type>
            </environment:dependency>
          </environment:dependencies>
        </environment:environment></attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/axis2/2.1/car"/>
    <module name="org.apache.geronimo.configs/jasper-deployer/2.1/car"/>
    <module name="org.apache.geronimo.configs/remote-deploy-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.configs/client-security/2.1/car" load="false"/>
    <module name="org.apache.geronimo.configs/client/2.1/car" load="false"/>
    <module name="org.apache.geronimo.configs/axis2-ejb-deployer/2.1/car" condition="props['org.apache.geronimo.jaxws.provider'] == 'axis2' or
    (props['org.apache.geronimo.jaxws.provider'] == null and webcontainerName == 'tomcat6')">
        <gbean name="Axis2ModuleBuilderExtension">
            <attribute name="listener">?name=${webcontainer}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/jaxws-ejb-deployer/2.1/car"/>
    <module name="org.apache.geronimo.configs/jaxws-deployer/2.1/car"/>
    <module name="org.apache.geronimo.configs/openejb-deployer/2.1/car">
        <gbean name="EjbRefBuilder">
            <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee,http://java.sun.com/xml/ns/javaee</attribute>
        </gbean>
        <gbean name="ClientEjbRefBuilder">
            <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee,http://java.sun.com/xml/ns/javaee</attribute>
            <attribute name="host">${ServerHostname}</attribute>
            <attribute name="port">${OpenEJBPort + PortOffset}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/axis2-deployer/2.1/car" condition="props['org.apache.geronimo.jaxws.provider'] == 'axis2' or 
    (props['org.apache.geronimo.jaxws.provider'] == null and webcontainerName == 'tomcat6')"/>
    <module name="org.apache.geronimo.configs/axis2-ejb/2.1/car"/>
    <module name="org.apache.geronimo.configs/ca-helper-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.plugins/agent/2.1/car"/>
    <module name="org.apache.geronimo.plugins/agent-ds/2.1/car"/>
    <module name="org.apache.geronimo.configs/mejb/2.1/car"/>
    <module name="org.apache.geronimo.configs/tomcat6-clustering-builder-wadi/2.1/car">
        <gbean name="TomcatClusteringBuilder">
            <attribute name="defaultSweepInterval">${DefaultWadiSweepInterval}</attribute>
            <attribute name="defaultNumPartitions">${DefaultWadiNumPartitions}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/tomcat6-deployer/2.1/car"/>
    <module name="org.apache.geronimo.configs/tomcat6-clustering-wadi/2.1/car" load="false"/>
    <module name="org.apache.geronimo.configs/wadi-clustering/2.1/car" load="false">
        <gbean name="DefaultBackingStrategyFactory">
            <attribute name="nbReplica">${ReplicaCount}</attribute>
        </gbean>
        <gbean name="DefaultDispatcherHolder">
            <attribute name="endPointURI">${EndPointURI}</attribute>
            <attribute name="clusterName">${ClusterName}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/clustering/2.1/car">
        <gbean name="Node">
            <attribute name="nodeName">${clusterNodeName}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.plugins/debugviews-console-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.plugins/console-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.plugins/pluto-support/2.1/car"/>
    <module name="org.apache.geronimo.configs/spring/2.1/car"/>
    <module name="org.apache.geronimo.configs/dojo-legacy-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.configs/persistence-jpa10-deployer/2.1/car">
        <gbean name="PersistenceUnitBuilder">
            <attribute name="defaultPersistenceProviderClassName">org.apache.openjpa.persistence.PersistenceProviderImpl</attribute>
            <attribute name="defaultPersistenceUnitProperties">openjpa.Log=commons
                                        openjpa.jdbc.SynchronizeMappings=buildSchema(ForeignKeys=true)
                                        openjpa.jdbc.UpdateManager=operation-order
                                        openjpa.Sequence=table(Table=OPENJPASEQ, Increment=100)</attribute>
            <attribute propertyEditor="org.apache.geronimo.deployment.service.EnvironmentBuilder" name="defaultEnvironment">
                <environment:environment xmlns:environment="http://geronimo.apache.org/xml/ns/deployment-1.2">
                    <environment:dependencies>
                        <environment:dependency>
                            <environment:groupId>org.apache.geronimo.configs</environment:groupId>
                            <environment:artifactId>openjpa</environment:artifactId>
                            <environment:type>car</environment:type>
            </environment:dependency>
          </environment:dependencies>
        </environment:environment></attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.plugins/plugin-console-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.plugins/plancreator-console-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.framework/upgrade-cli/2.1/car" load="false"/>
    <module name="org.apache.geronimo.configs/axis-deployer/2.1/car">
        <gbean name="AxisModuleBuilderExtension">
            <attribute name="listener">?name=${webcontainer}</attribute>
            <attribute propertyEditor="org.apache.geronimo.deployment.service.EnvironmentBuilder" name="defaultEnvironment">
                <environment:environment xmlns:environment="http://geronimo.apache.org/xml/ns/deployment-1.2">
                    <environment:dependencies>
                        <environment:dependency>
                            <environment:groupId>org.apache.geronimo.configs</environment:groupId>
                            <environment:artifactId>${webcontainerName}</environment:artifactId>
                            <environment:type>car</environment:type>
            </environment:dependency>
          </environment:dependencies>
        </environment:environment></attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/j2ee-corba-yoko/2.1/car">
        <gbean name="NameServer">
            <attribute name="port">${COSNamingPort + PortOffset}</attribute>
            <attribute name="host">${COSNamingHost}</attribute>
        </gbean>
        <gbean name="Server">
            <attribute name="port">${ORBSSLPort + PortOffset}</attribute>
            <attribute name="host">${ORBSSLHost}</attribute>
        </gbean>
        <gbean name="UnprotectedServer">
            <attribute name="port">${ORBPort + PortOffset}</attribute>
            <attribute name="host">${ORBHost}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/hot-deployer/2.1/car">
        <gbean name="HotDeployer">
            <attribute name="path">deploy/</attribute>
            <attribute name="pollIntervalMillis">2000</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/farming/2.1/car" load="false">
        <gbean name="NodeInfo">
            <attribute name="name">${clusterNodeName}</attribute>
        </gbean>
        <gbean name="ClusterInfo">
            <attribute name="name">${clusterName}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.plugins/sysdb-console-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.framework/offline-deployer/2.1/car" load="false"/>
    <module name="org.apache.geronimo.configs/openejb-corba-deployer/2.1/car"/>
    <module name="org.apache.geronimo.plugins/activemq-console-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.configs/client-corba-yoko/2.1/car" load="false"/>
    <module name="org.apache.geronimo.configs/javamail/2.1/car">
        <gbean name="SMTPTransport">
            <attribute name="host">${SMTPHost}</attribute>
            <attribute name="port">${SMTPPort + PortOffset}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/cxf-deployer/2.1/car" condition="props['org.apache.geronimo.jaxws.provider'] == 'cxf' or 
    (props['org.apache.geronimo.jaxws.provider'] == null and webcontainerName == 'jetty6')"/>
    <module name="org.apache.geronimo.configs/cxf/2.1/car"/>
    <module name="org.apache.geronimo.configs/welcome-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.configs/sharedlib/2.1/car"/>
    <module name="org.apache.geronimo.plugins/mconsole-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.plugins/mconsole-ds/2.1/car"/>
    <module name="org.apache.geronimo.configs/client-deployer/2.1/car"/>
    <module name="org.apache.geronimo.configs/client-transaction/2.1/car" load="false"/>
    <module name="org.apache.geronimo.configs/cxf-ejb-deployer/2.1/car" condition="props['org.apache.geronimo.jaxws.provider'] == 'cxf' or 
    (props['org.apache.geronimo.jaxws.provider'] == null and webcontainerName == 'jetty6')">
        <gbean name="CXFModuleBuilderExtension">
            <attribute name="listener">?name=${webcontainer}</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/cxf-ejb/2.1/car"/>
    <module name="org.apache.geronimo.configs/dojo-tomcat/2.1/car"/>
    <module name="org.apache.geronimo.configs/jsr88-ear-configurer/2.1/car" load="false"/>
    <module name="org.apache.geronimo.configs/jsr88-jar-configurer/2.1/car" load="false"/>
    <module name="org.apache.geronimo.configs/jsr88-war-configurer/2.1/car" load="false"/>
    <module name="org.apache.geronimo.framework/jsr88-deploymentfactory/2.1/car" load="false"/>
</attributes>

Note: Some tags in the config.xml shown above are presented in multiple lines for displaying purposes only.

...

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 on, in this case virtualhost1.com.

...

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.

...

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.

...

At this point you have configured Geronimo to use two different Virtual Hosts, one of them is also configured to listen under additional aliases. All you need to do now is to deploy the applications and test them. To deploy the applications type the following commands from the <GERONIMO_HOME>\bin directory:

deploy --user system --password manager deploy <APP_HOME>\HelloWorld_1.war

You should get a successful confirmation message similar to this one:

No Format
bgColor#000000
borderStylesolid

D:\geronimo-tomcat6-jee5-2.1\bin>deploy --user system --password manager deploy \HelloWorld_2.1\HelloWorld_1.war
Using GERONIMO_BASE:   D:\geronimo-tomcat6-jee5-2.1
Using GERONIMO_HOME:   D:\geronimo-tomcat6-jee5-2.1
Using GERONIMO_TMPDIR: var\temp
Using JRE_HOME:        C:\Java\jdk1.5.0_06\jre
    Deployed sample.applications/HelloWorldApp_1/2.1/war @

...


    /hello_1

 

Repeat the deployment for the second application.

deploy --user system --password manager deploy <APP_HOME>\HelloWorld_2.war

You should get a successful confirmation message similar to this one:

No Format
bgColor#000000
borderStylesolid

D:\geronimo-tomcat6-jee5-2.1\bin>deploy --user system --password manager deploy \HelloWorld_2.1\HelloWorld_2.war
Using GERONIMO_BASE:   D:\geronimo-tomcat6-jee5-2.1
Using GERONIMO_HOME:   D:\geronimo-tomcat6-jee5-2.1
Using GERONIMO_TMPDIR: var\temp
Using JRE_HOME:        C:\Java\jdk1.5.0_06\jre
    Deployed sample.applications/HelloWorldApp_2/2.1/war @

...


    /hello_2

 

With the applications deployed the only thing left is to test them. Test hello_1 first, try to access the hosts names defined on the Geronimo server machine:

...