Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

To define the first HostGBean TomcatVirtualHost_1 add the following lines right after <module name="org.apache.geronimo.configs/tomcat6/2.1/car">.

Code Block
xml
xml
borderStylesolid
titleExcerpt from config.xmlxml
...
<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>
</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.xmlxml
...
<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>
...

...

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.xmlxml
<?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>

        <!-- 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">
            <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>


        <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>

...

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.

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

...

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_2xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
    <environment>
        <moduleId>
            <groupId>sample.applications</groupId>
            <artifactId>HelloWorldApp_2</artifactId>
            <version>2.1</version>
            <type>war</type>
        </moduleId>
    </environment>
    <context-root>/hello_2</context-root>
    <host>virtualhost2.com</host>
</web-app>

...