Versions Compared

Key

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

...

Open the config.xml file located in the <geronimo_home>/var directory and look for the following line <module name="org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/car">. This is the beginning of the Tomcat configuration module, all the additional virtual host configuration will be done immediately after this line.

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

Code Block
xml
xml
borderStylesolid
titleExcerpt from config.xml
...
<gbean gbeanInfo="org.apache.geronimo.tomcat.HostGBean" name="org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/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>
...

...

Code Block
xml
xml
borderStylesolid
titleExcerpt from config.xml
...
<gbean gbeanInfo="org.apache.geronimo.tomcat.HostGBean" name="org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/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>
...

...

Code Block
xml
xml
borderStylesolid
titleconfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================== -->
<!-- Warning - This XML file is re-generated by Geronimo when -->
<!-- changes are made to Geronimo's configuration, therefore  -->
<!-- any comments added to this file will be lost.            -->
<!-- Do not edit this file while Geronimo is running.         -->
<!-- ======================================================== -->
<attributes xmlns="http://geronimo.apache.org/xml/ns/attributes-1.1">
    <module name="org.apache.geronimo.configs/rmi-naming/1.12-SNAPSHOT/car">
<gbean         <gbean name="RMIRegistry">
            <attribute name="port">1099</attribute>
        </gbean>
        <gbean name="NamingProperties">
            <attribute name="namingProviderUrl">rmi://0.0.0.0:1099</attribute>
        </gbean>
        <gbean name="DownloadedPluginRepos">
<attribute name="repositoryList"            <attribute name="repositoryList">http://peoplegeronimo.apache.org/~ammulderplugins/plugin-repository-list-1.12.txt</attribute>
            <attribute name="userRepositories">[]</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/j2ee-server/1.12-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/j2ee-securitytransaction/1.12-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/j2ee-security/1.2-SNAPSHOT/car">
        <gbean name="JaasLoginServiceRemotingServer">
            <attribute name="host">0.0.0.0</attribute>
            <attribute name="port">4242</attribute>
        </gbean>
<gbean name        <gbean name="JMXService">
            <attribute name="protocol">rmi</attribute>
            <attribute name="host">0.0.0.0</attribute>
            <attribute name="port">9999</attribute>
            <attribute name="urlPath">/jndi/rmi://0.0.0.0:1099/JMXConnector</attribute>
        </gbean>
    </module>
    <module name="geronimoorg.apache.geronimo.configs/axis/1.12-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/openejb/1.12-SNAPSHOT/car">
        <gbean name="EJBNetworkService">
            <attribute name="host">0.0.0.0</attribute>
            <attribute name="port">4201</attribute>
        </gbean>
    </module>
    <module load="false" name="org.apache.geronimo.configs/j2ee-corba-yoko/1.12-SNAPSHOT/car">
        <gbean name="NameServer">
            <attribute name="dbDirport">var>1050</cosnaming.db</attribute>
            <attribute name="porthost">1050<>localhost</attribute>
        </gbean>
<gbean name="Server">
<attribute name="args">-ORBInitRef, NameService=corbaloc::localhost:1050/NameService</attribute>
</gbean>
    </module>
    <module load="false" name="org.apache.geronimo.configs/j2ee-corba-sun/1.2-SNAPSHOT/car">
        <gbean name="UnprotectedServerNameServer">
            <attribute name="args">-ORBInitRef, NameService=corbaloc::localhost:1050/NameService</attribute>
port">1050</attribute>
            <attribute name="host">localhost</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/system-database/1.12-SNAPSHOT/car">
        <gbean name="DerbyNetwork">
<attribute name="host"            <attribute name="host">0.0.0.0</attribute>
            <attribute name="port">1527</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/activemq-broker/1.12-SNAPSHOT/car">
        <gbean name="ActiveMQ.tcp.default">
            <attribute name="host">0.0.0.0</attribute>
<attribute name            <attribute name="port">61616</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/activemq/1.12-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/car">
    <!-- ================================================= -->
	<!--    First HostGBean TomcatVirtualHost_1 defined    -->
    <!-- ============================================ ===== -->
	    <gbean gbeanInfo="org.apache.geronimo.tomcat.HostGBean" name="org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/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>
    <!-- ================================================= -->
	<!--   Second HostGBean TomcatVirtualHost_12 defined    -->
    <!-- ================================================= -->
	    <gbean gbeanInfo="org.apache.geronimo.tomcat.HostGBean" name="org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/car,j2eeType=Host,name=TomcatVirtualHost_2">
            <attribute name="className">org.apache.catalina.core.StandardHost</attribute>
<attribute name            <attribute name="initParams">name=virtualhost2.com
                appBase=
                workDir=work</attribute>
            <attribute name="aliases">virtualhost3.com,virtualhost4.com</attribute>
        </gbean>
<!-- ============================================ -->
<gbean name="TomcatResources"/>
<gbean name="TomcatWebConnector">
        <gbean name="TomcatResources"/>
        <gbean name="TomcatWebConnector">
            <attribute name="host">0.0.0.0</attribute>
<attribute             <attribute name="port">8080</attribute>
            <attribute name="redirectPort">8443</attribute>
        </gbean>
        <gbean name="TomcatAJPConnector">
            <attribute name="host">0.0.0.0</attribute>
            <attribute name="port">8009</attribute>
<attribute name="redirectPort"            <attribute name="redirectPort">8443</attribute>
        </gbean>
        <gbean name="TomcatWebSSLConnector">
            <attribute name="host">0.0.0.0</attribute>
            <attribute name="port">8443</attribute>
        </gbean>
        <gbean name="org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/car?ServiceModule=org.apache.geronimo.configs/tomcat/1.12-SNAPSHOT/car,j2eeType=GBean,name=TomcatWebContainer">
            <attribute name="catalinaHome">var/catalina</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/geronimo-gbean-deployer/1.12-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/j2ee-deployer/1.12-SNAPSHOT/car">
        <gbean name="WebBuilder">
<attribute             <attribute name="defaultNamespace">http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1<2</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/openejbconnector-deployer/1.12-SNAPSHOT/car"/>
<gbean name="EJBBuilder">
<attribute    <module condition="java.is1_5" name="listener">?name=TomcatWebContainer</attribute>
</gbean>
</module>
<module name="geronimo/clientorg.apache.geronimo.configs/persistence-jpa10-deployer/1.12-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/axisopenejb-deployer/1.12-SNAPSHOT/car"/>
<module load="false" name="geronimo/javamail/1.1/car">
        <gbean name="SMTPTransportEJBBuilder">
<attribute name="host">localhost</attribute>
            <attribute name="port">25</attribute>
</gbean>
</module>
<modulelistener">?name=TomcatWebContainer</attribute>
            <reference name="geronimo/sharedlib/1.1/carServiceBuilders">
<gbean name="SharedLib">
<attribute name="classesDirs"                <pattern>
                    <name>GBeanBuilder</name>
                </pattern>
                <pattern>
                    <name>PersistenceUnitBuilder</name>
                </pattern>
            </reference>
        </gbean>
    </module>
    <module load="false" name="org.apache.geronimo.configs/openejb-corba-deployer/1.2-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/client-deployer/1.2-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/axis-deployer/1.2-SNAPSHOT/car"/>
    <module load="false" name="org.apache.geronimo.configs/javamail/1.2-SNAPSHOT/car">
        <gbean name="SMTPTransport">
            <attribute name="host">localhost</attribute>
            <attribute name="port">25</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/sharedlib/1.2-SNAPSHOT/car">
        <gbean name="SharedLib">
            <attribute name="classesDirs">var/shared/classes</attribute>
            <attribute name="libDirs">var/shared/lib</attribute>
        </gbean>
    </module>
    <module name="org.apache.geronimo.configs/tomcat-deployer/1.12-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/welcome-tomcat/1.12-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/webconsole-tomcat/1.12-SNAPSHOT/car"/>
    <module load="false" name="org.apache.geronimo.configs/uddi-tomcat/1.12-SNAPSHOT/car"/>
    <module name="org.apache.geronimo.configs/remote-deploy-tomcat/1.12-SNAPSHOT/car"/>

    <module name="org.apache.geronimo.configs/hot-deployer/1.12-SNAPSHOT/car"/>
    <module load="false" name="sample.applications/HelloWorldApporg.apache.geronimo.configs/ca-helper-tomcat/1.12-SNAPSHOT/warcar"/>
</attributes>

Back to Top

...

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

...

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.12">
    <environment>
        <moduleId>
            <groupId>sample.applications</groupId>
            <artifactId>HelloWorldApp_1</artifactId>
            <version>1.1<2</version>
            <type>war</type>
        </moduleId>		
    </environment>
    <context-root>/hello_1</context-root>
    <host>virtualhost1.com</host>
</web-app>

...

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.12">
    <environment>
        <moduleId>
            <groupId>sample.applications</groupId>applications</groupId>
            <artifactId>HelloWorldApp_2</artifactId>
            <artifactId>HelloWorldApp_<version>1.2</artifactId>version>
            <version>1.1<<type>war</version>type>
        </moduleId>		     
    </environment>
    <context-root>/hello_2</context-root>
    <host>virtualhost2.com</host>
</web-app>

...

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:

java -jar deployer.jar --user system --password manager deploy <app_home>\HelloWorld_1.war

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

:

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-tomcat-j2ee-1.2\bin>deploy --user system --password manager deploy \VH-sample-Tomcat\HelloWorld_1.2\HelloWorld_1.war
Using GERONIMO_BASE:   D:\geronimo-tomcat-j2ee-1.2
Using GERONIMO_HOME:   D:\geronimo-tomcat-j2ee-1.2
Using GERONIMO_TMPDIR: D:\geronimo-tomcat-j2ee-1.2\var\temp
Using JRE_HOME:        C:\Java\jdk1.5.0_06\\jre
No Format
bgColor#000000
borderStylesolid

D:\geronimo-1.1\bin>java -jar deployer.jar --user system --password manager deploy \000-VH-sample\HelloWorld-VH\HelloWorld_1.war
    Deployed sample.applications/HelloWorldApp_1/1.12/war @
    http://hcunico:8080/hello_1

...

Repeat the deployment for the second application.

java -jar deployer.jar .jar --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-tomcat-j2ee-1.2\bin>deploy --user system --password manager
deploy <app_home>
 deploy \VH-sample-Tomcat\HelloWorld_1.2\HelloWorld_2.war

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

No Format
bgColor#000000
borderStylesolid

D:\geronimo-1.1\bin>java -jar deployer.jar --user system --password manager deploy \000-VH-sample\HelloWorld-VH\HelloWorld_2.war
Using GERONIMO_BASE:   D:\geronimo-tomcat-j2ee-1.2
Using GERONIMO_HOME:   D:\geronimo-tomcat-j2ee-1.2
Using GERONIMO_TMPDIR: D:\geronimo-tomcat-j2ee-1.2\var\temp
Using JRE_HOME:        C:\Java\jdk1.5.0_06\\jre
    Deployed sample.applications/HelloWorldApp_2/1.12/war @
    http://hcunico:8080/hello_2

...