Versions Compared

Key

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

...

This article used the simple HelloWorld application as a reference, this application is covered in the Quick start - Apache Geronimo for the impatient section.

Configure local host or DNS

To make this configuration work you need to ensure that Geronimo can resolve the virtual host name you are about to define. Depending on your network configuration you can add an entry to you DNS, an alias to the Geronimo server IP. Alternatively you can add an entry to the local host table, each operating system has it's own way to define a local host table. For example Windows will have %SystemRoot%\system32\drivers\etc\hosts, Unix based operating systems would normally have an /etc/hosts.

For this example we will be using the following host names defines 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.

Define Virtual host

Now you need to define those virtual hosts in Geronimo's config.xml so it can recognize them. This section provides two different virtual hosts definitions (TomcatVirtualHost1 and TomcatVirtualHost2) in the Geronimo configuration, in other words we will be defining two different virtual hosts, one of those will have multiple aliases. The goal of this example is to have standard predeployed applications listening by default on all the available host names. Then to have an application listening on a single virtual host ( this will be virtualhost1.com ) and another application listening on a different virtual host ( this will be virtualhost2.com ) with two additional aliases ( this will be virtualhost3.com and virtualhost4.com )

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

Code Block
xml
xml
borderStylesolid
titleExcerpt from config.xml
...
<module name="geronimo/tomcat/1.1/car">
<gbean gbeanInfo="org.apache.geronimo.tomcat.HostGBean" name="geronimo/tomcat/1.1/car?ServiceModule=geronimo/tomcat/1.1/car,j2eeType=Host,name=TomcatVirtualHostTomcatVirtualHost1">
<attribute name="className">org.apache.catalina.core.StandardHost</attribute>
<attribute name="initParams">name=host1.com
       appBase=
       workDir=work</attribute>
</gbean>
...

...