...
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.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- $Rev: 562176 $ $Date: 2007-08-02 12:31:43 -0400 (Thu, 02 Aug 2007) $ --> <!-- ======================================================== --> <!-- 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. --> <!-- ======================================================== --> <attributes xmlns="http://geronimo.apache.org/xml/ns/attributes-1.1"> <module name="org.apache.geronimo.configs/rmi-naming/2.0/car"> <gbean name="RMIRegistry"> <attribute name="port">${NamingPort + PortOffset}</attribute> </gbean> <gbean name="NamingProperties"> <!-- Check whether this really works if host name is 0.0.0.0 --> <attribute name="namingProviderUrl">rmi://${ServerHostname}:${NamingPort + PortOffset}</attribute> </gbean> <gbean name="DownloadedPluginRepos"> <attribute name="repositoryList">http://geronimo.apache.org/plugins/plugin-repository-list-2.1.txt</attribute> <attribute name="userRepositories">[]</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/j2ee-server/2.1/car"/> <module name="org.apache.geronimo.configs/transaction/2.1/car"/> <module name="org.apache.geronimo.configs/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.configs/axis/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/axis2/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/cxf/2.1/car" load="false"/> <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/j2ee-corba-yoko/2.1/car" load="false"> <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/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/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/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/jasper/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/myfaces/2.1/car"/> <module name="org.apache.geronimo.configs/tomcat6/2.1/car"> <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> <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> <!-- To disable accesslogging uncomment the following lines <gbean name="TomcatEngine"> <reference name="TomcatValveChain" /> </gbean> <gbean name="FirstValve" load="false"></gbean> --> <gbean name="TomcatResources"/> <gbean name="TomcatWebConnector"> <attribute name="host">${ServerHostname}</attribute> <attribute name="port">${HTTPPortPrimary + PortOffset}</attribute> <attribute name="redirectPort">${HTTPSPortPrimary + PortOffset}</attribute> </gbean> <gbean name="TomcatAJPConnector"> <attribute name="host">${ServerHostname}</attribute> <attribute name="port">${AJPPortPrimary + PortOffset}</attribute> <attribute name="redirectPort">${HTTPSPortPrimary + PortOffset}</attribute> </gbean> <gbean name="TomcatWebSSLConnector"> <attribute name="host">${ServerHostname}</attribute> <attribute name="port">${HTTPSPortPrimary + PortOffset}</attribute> </gbean> </module> <!-- NOTE: n.b. be sure the gbean deployer is explicitly loaded before j2ee-deployer so that defaultEnvironment overrides work properly --> <module name="org.apache.geronimo.configs/geronimo-gbean-deployer/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/tomcat-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.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 name="defaultEnvironment"> <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <dependencies> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>j2ee-corba-yoko</artifactId> <type>car</type> </dependency> </dependencies> </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 name="defaultEnvironment"> <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <dependencies> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>client-corba-yoko</artifactId> <type>car</type> </dependency> </dependencies> </environment> </attribute> </gbean> </module> <module name="org.apache.geronimo.configs/persistence-jpa10-deployer/2.0/car"> <gbean name="PersistenceUnitBuilder"> <attribute name="defaultPersistenceProviderClassName">org.apache.openjpa.persistence.PersistenceProviderImpl</attribute> <attribute name="defaultPersistenceUnitProperties"> openjpa.Log=commons # openjpa.jdbc.DBDictionary=org.apache.openjpa.jdbc.sql.DerbyDictionary openjpa.jdbc.SynchronizeMappings=buildSchema(ForeignKeys=true) openjpa.jdbc.UpdateManager=operation-order openjpa.Sequence=table(Table=OPENJPASEQ, Increment=100) </attribute> <attribute name="defaultEnvironment"> <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <dependencies> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>openjpa</artifactId> <type>car</type> </dependency> </dependencies> </environment> </attribute> </gbean> </module> <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> </gbean> </module> <module name="org.apache.geronimo.configs/client-deployer/2.1/car"> </module> <module name="org.apache.geronimo.configs/axis2-deployer/2.1/car" condition="props.getProperty('org.apache.geronimo.jaxws.provider', 'axis2') == 'axis2'"> <gbean name="Axis2ModuleBuilderExtension"> <attribute name="listener">?name=TomcatWebContainer</attribute> <attribute name="defaultEnvironment"> <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <dependencies> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>tomcat6</artifactId> <type>car</type> </dependency> </dependencies> </environment> </attribute> </gbean> </module> <module name="org.apache.geronimo.configs/cxf-deployer/2.1/car" condition="props['org.apache.geronimo.jaxws.provider'] == 'cxf'"> <gbean name="CXFModuleBuilderExtension"> <attribute name="listener">?name=TomcatWebContainer</attribute> <attribute name="defaultEnvironment"> <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <dependencies> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>tomcat6</artifactId> <type>car</type> </dependency> </dependencies> </environment> </attribute> </gbean> </module> <module name="org.apache.geronimo.configs/axis-deployer/2.1/car"> <gbean name="AxisServiceRefBuilder"> <attribute name="eeNamespaces">http://java.sun.com/xml/ns/j2ee,http://java.sun.com/xml/ns/javaee</attribute> </gbean> <gbean name="AxisModuleBuilderExtension"> <attribute name="listener">?name=TomcatWebContainer</attribute> <attribute name="defaultEnvironment"> <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2"> <dependencies> <dependency> <groupId>org.apache.geronimo.configs</groupId> <artifactId>tomcat6</artifactId> <type>car</type> </dependency> </dependencies> </environment> </attribute> </gbean> </module> <module name="org.apache.geronimo.configs/javamail/2.1/car"> <gbean name="SMTPTransport"> <attribute name="host">localhost</attribute> <attribute name="port">25</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/sharedlib/2.1/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/tomcat6-deployer/2.1/car"/> <module name="org.apache.geronimo.configs/jasper-deployer/2.1/car"/> <module name="org.apache.geronimo.configs/myfaces-deployer/2.1/car"/> <module name="org.apache.geronimo.configs/welcome-tomcat/2.1/car"/> <module name="org.apache.geronimo.configs/dojo-tomcat/2.1/car"/> <module name="org.apache.geronimo.configs/webconsole-tomcat/2.1/car"/> <module name="org.apache.geronimo.configs/uddi-tomcat/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/remote-deploy-tomcat/2.1/car" /> <module name="org.apache.geronimo.configs/hot-deployer/2.1/car"/> <module name="org.apache.geronimo.configs/jsr88-rar-configurer/2.1/car"/> <module name="org.apache.geronimo.configs/ca-helper-tomcat/2.1/car" load="false"/> </attributes> |
Declare the virtual host in the deployment plan
...
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.
Deploy the application
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:
...