This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • D. Configurando Hosts Virtuales en Geronimo-Tomcat

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Anchortoptop

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 to listen on a specific host name or IP. The configuration steps described in this article are also valid then you are sharing a single IP among several host names.

...

To define the first HostGBean TomcatVirtualHost_1 add the following lines right after <module name="geronimo/tomcat/1.1/car">.

...

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.

...

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 the entire config.xml with the two HostGBean already defined.

...

Back to Top

Declare the virtual host in the deployment plan

...

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

...

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

...

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.

...

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:

...

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

No FormatbgColor#000000borderStylesolid 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.1/war @ http://hcunico:8080/hello_1

Note that the deployer tool will not tell the Virtual Host where the application was deployed to, it will only tell the machine's defined host name. If you try to access that URL you should get a HTTP Status 404 - /hello_1, resource not available. That error message is a good sign since we deployed the application to a particular Virtual Host.

...

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

No FormatbgColor#000000borderStylesolid D:\geronimo-1.1\bin>java -jar deployer.jar --user system --password manager deploy \000-VH-sample\HelloWorld-VH\HelloWorld_2.war Deployed sample.applications/HelloWorldApp_2/1.1/war @ http://hcunico:8080/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:

...