...
最初のHostGBeanである TomcatVirtualHost_1
を定義するには、 <module name="org.apache.geronimo.configs/tomcat6/2.0/car">
という行のすぐ次に以下の行を追加してください。
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
... <gbean gbeanInfo="org.apache.geronimo.tomcat.HostGBean" name="org.apache.geronimo.configs/tomcat6/2.0/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.0/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> ... |
2番目のHostGBeanである TomcatVirtualHost_2
の定義は、最初のHostGBeanのすぐ下に追加してください。この2つのHostGBeanは別々に分離されているので見分けるのは容易でしょう。この2つは、別名を定義するための <attribute name="aliases">..,..</attribute>
の部分が異なっています。
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
... <gbean gbeanInfo="org.apache.geronimo.tomcat.HostGBean" name="org.apache.geronimo.configs/tomcat6/2.0/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.0/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> ... |
...
ご参考までに、下記に2つのHostGBeanが定義済の config.xml
の全体を掲載します。
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.0.txt</attribute> <attribute name="userRepositories">[]</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/j2ee-server/2.0/car"/> <module name="org.apache.geronimo.configs/transaction/2.0/car"/> <module name="org.apache.geronimo.configs/j2ee-security/2.0/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.0/car" load="false"/> <module name="org.apache.geronimo.configs/axis2/2.0/car" load="false"/> <module name="org.apache.geronimo.configs/cxf/2.0/car" load="false"/> <module name="org.apache.geronimo.configs/openejb/2.0/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.0/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.0/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.0/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.0/car"> <gbean name="ActiveMQ RA"> <attribute name="ServerUrl">tcp://${ServerHostname}:${ActiveMQPort + PortOffset}</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/jasper/2.0/car" load="false"/> <module name="org.apache.geronimo.configs/myfaces/2.0/car"/> <module name="org.apache.geronimo.configs/tomcat6/2.0/car"> <gbean gbeanInfo="org.apache.geronimo.tomcat.HostGBean" name="org.apache.geronimo.configs/tomcat6/2.0/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.0/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.0/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.0/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.0/car"/> <module name="org.apache.geronimo.configs/j2ee-deployer/2.0/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.0/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.0/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.0/car"> </module> <module name="org.apache.geronimo.configs/axis2-deployer/2.0/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.0/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.0/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.0/car"> <gbean name="SMTPTransport"> <attribute name="host">localhost</attribute> <attribute name="port">25</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/sharedlib/2.0/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.0/car"/> <module name="org.apache.geronimo.configs/jasper-deployer/2.0/car"/> <module name="org.apache.geronimo.configs/myfaces-deployer/2.0/car"/> <module name="org.apache.geronimo.configs/welcome-tomcat/2.0/car"/> <module name="org.apache.geronimo.configs/dojo-tomcat/2.0/car"/> <module name="org.apache.geronimo.configs/webconsole-tomcat/2.0/car"/> <module name="org.apache.geronimo.configs/uddi-tomcat/2.0/car" load="false"/> <module name="org.apache.geronimo.configs/remote-deploy-tomcat/2.0/car" /> <module name="org.apache.geronimo.configs/hot-deployer/2.0/car"/> <module name="org.apache.geronimo.configs/jsr88-rar-configurer/2.0/car"/> <module name="org.apache.geronimo.configs/ca-helper-tomcat/2.0/car" load="false"/> </attributes> |
...
geronimo-web.xml
ファイルを開き、デプロイメントがユニークになるように artifactId
と context-root
を編集してください。更に web-app
セクションに host
属性を追加して、このアプリケーションにリスンさせたい仮想ホスト、このケースでは virtualhost1.com
を記述します。
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.2"> <environment> <moduleId> <groupId>sample.applications</groupId> <artifactId>HelloWorldApp_1</artifactId> <version>2.0</version> <type>war</type> </moduleId> </environment> <context-root>/hello_1</context-root> <host>virtualhost1.com</host> </web-app> |
...
この手順を繰り返して2番目のWARを作ります、再度 geronimo-web.xml
ファイルを編集し下記の例から中身をコピーしてください。変更するのは artifactId
, context-root
と host
だけですのでご注意ください。
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.2"> <environment> <moduleId> <groupId>sample.applications</groupId> <artifactId>HelloWorldApp_2</artifactId> <version>2.0</version> <type>war</type> </moduleId> </environment> <context-root>/hello_2</context-root> <host>virtualhost2.com</host> </web-app> |
...