unmigrated-inline-wiki-markup |
---|
{scrollbar} |
...
Excerpt |
---|
...
This |
...
article |
...
shows |
...
how |
...
to |
...
configure |
...
Virtual |
...
Hosts |
...
in |
...
Apache |
...
Geronimo |
...
with |
...
Tomcat. |
...
...
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
...
listen
...
on
...
a
...
specific
...
host
...
name
...
or
...
IP.
...
The
...
configuration
...
steps
...
described
...
in
...
this
...
article
...
are
...
also
...
valid
...
when
...
you
...
are
...
sharing
...
a
...
single
...
IP
...
among
...
several
...
host
...
names.
...
To
...
configure
...
a
...
virtual
...
host
...
in
...
Geronimo
...
you
...
basically
...
need
...
to:
...
Table of Contents |
---|
...
|
...
|
...
This
...
article
...
used
...
the
...
simple
...
HelloWorld
...
application
...
as
...
a
...
reference,
...
this
...
application
...
is
...
covered
...
in
...
the
...
...
...
...
...
...
...
...
...
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
...
defined
...
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, that is creating two new HostGBean ( TomcatVirtualHost1 and TomcatVirtualHost2 ) in the Geronimo configuration, one of those will have multiple host names aliases. The goal of this example is 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="org.apache.geronimo.configs/tomcat6/2.1/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/tomcat6/2.1/car">
...
.
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
{code:xml|borderStyle=solid|title=Excerpt from
| |||||||||
} ... <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> <reference name="Engine"> <pattern> <name>TomcatEngine</name> </pattern> </reference> </gbean> ... {code} |
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.
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
{code:xml|borderStyle=solid|title=Excerpt from
| |||||||||
} ... <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> <reference name="Engine"> <pattern> <name>TomcatEngine</name> </pattern> </reference> </gbean> ... {code} |
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
...
...
Geronimo.
...
For
...
additional
...
reference,
...
this
...
is
...
an
...
excerpt
...
from
...
config.xml
...
of
...
the
...
entire
...
<module
...
name="org.apache.geronimo.configs/tomcat6/2.1/car">
...
entry
...
with
...
the
...
two
...
HostGBean
...
already
...
defined.
Code Block | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
| ||||||||
} <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <attributes xmlns:ns2="http://geronimo.apache.org/xml/ns/plugins-1.3" xmlns="http://geronimo.apache.org/xml/ns/attributes-1.2"> <comment> ================================================================== Warning - This XML file is regenerated by Geronimo whenever changes are made to Geronimo's configuration. If you want to include comments, create a single comment element element. They are allowable at any level of the configuration. !!!! Do not edit this file while Geronimo is running !!!! ==================================================================</comment> <module name="org.apache.geronimo.framework/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.framework/rmi-naming/2.1/car"> <gbean name="RMIRegistry"> <attribute name="port">${NamingPort + PortOffset}</attribute> </gbean> <gbean name="NamingProperties"> <attribute name="namingProviderUrl">rmi://${ServerHostname}:${NamingPort + PortOffset}</attribute> </gbean> <gbean name="DefaultThreadPool"> <attribute name="keepAliveTime">30000</attribute> <attribute name="minPoolSize">${MinThreadPoolSize}</attribute> <attribute name="maxPoolSize">${MaxThreadPoolSize}</attribute> </gbean> </module> <module name="org.apache.geronimo.framework/j2ee-system/2.1/car"/> <module name="org.apache.geronimo.framework/jee-specs/2.1/car"/> <module name="org.apache.geronimo.framework/shutdown/2.1/car" load="false"/> <module name="org.apache.geronimo.framework/client-system/2.1/car" load="false"/> <module name="org.apache.geronimo.framework/online-deployer/2.1/car" load="false"/> <module name="org.apache.geronimo.framework/transformer-agent/2.1/car"/> <module name="org.apache.geronimo.framework/server-security-config/2.1/car"/> <module name="org.apache.geronimo.framework/plugin/2.1/car"> <gbean name="DownloadedPluginRepos"> <attribute name="repositoryList">http://geronimo.apache.org/plugins/plugin-repository-list-2.1.txt</attribute> <attribute name="userRepositories">~/.m2/repository</attribute> </gbean> </module> <module name="org.apache.geronimo.framework/xmlbeans/2.1/car"/> <module name="org.apache.geronimo.configs/myfaces-deployer/2.1/car"/> <module name="org.apache.geronimo.configs/myfaces/2.1/car"/> <module name="org.apache.geronimo.configs/j2ee-server/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/jetty-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.framework/geronimo-gbean-deployer/2.1/car"> <gbean name="Deployer"> <attribute name="remoteDeployAddress">http://${RemoteDeployHostname}:${HTTPPort + 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/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/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/transaction/2.1/car"> <gbean name="ResourceBindings"> <attribute name="format">${ResourceBindingsFormat}</attribute> <attribute name="nameInNamespace">${ResourceBindingsNameInNamespace}</attribute> <attribute name="namePattern">${ResourceBindingsNamePattern}</attribute> <attribute name="abstractNameQuery">${ResourceBindingsQuery}</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/uddi-tomcat/2.1/car"/> <module name="org.apache.geronimo.configs/axis/2.1/car"/> <module name="org.apache.geronimo.configs/webservices-common/2.1/car"/> <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/openjpa/2.1/car"/> <module name="org.apache.geronimo.configs/jasper/2.1/car"/> <module name="org.apache.geronimo.configs/tomcat6/2.1/car"> <!-- Virtual Host 1 definition --> <gbean name="org.apache.geronimo.configs/tomcat6/2.1/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.1/car, j2eeType=Host,name=TomcatVirtualHost_1" gbeanInfo="org.apache.geronimo.tomcat.HostGBean"> <attribute name="className">org.apache.catalina.core.StandardHost</attribute> <attribute name="initParams">name=virtualhost1.com appBase= workDir=work</attribute> <reference name="Engine"> <pattern> <name>TomcatEngine</name> </pattern> </reference> </gbean> <!-- Virtual Host 2 and aliases definition --> <gbean name="org.apache.geronimo.configs/tomcat6/2.1/car?ServiceModule=org.apache.geronimo.configs/tomcat6/2.1/car, j2eeType=Host,name=TomcatVirtualHost_2" gbeanInfo="org.apache.geronimo.tomcat.HostGBean"> <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> <reference name="Engine"> <pattern> <name>TomcatEngine</name> </pattern> </reference> </gbean> <gbean name="TomcatWebConnector"> <attribute name="host">${ServerHostname}</attribute> <attribute name="port">${HTTPPort + PortOffset}</attribute> <attribute name="redirectPort">${HTTPSPort + PortOffset}</attribute> <attribute name="maxHttpHeaderSize">8192</attribute> <attribute name="maxThreads">150</attribute> <attribute name="minSpareThreads">25</attribute> <attribute name="maxSpareThreads">75</attribute> <attribute name="enableLookups">false</attribute> <attribute name="acceptCount">100</attribute> <attribute name="connectionTimeout">${WebConnectorConTimeout}</attribute> <attribute name="disableUploadTimeout">true</attribute> </gbean> <gbean name="TomcatAJPConnector"> <attribute name="host">${ServerHostname}</attribute> <attribute name="port">${AJPPort + PortOffset}</attribute> <attribute name="redirectPort">${HTTPSPort + PortOffset}</attribute> <attribute name="minSpareThreads">25</attribute> <attribute name="maxSpareThreads">75</attribute> <attribute name="enableLookups">false</attribute> </gbean> <gbean name="TomcatWebSSLConnector"> <attribute name="host">${ServerHostname}</attribute> <attribute name="port">${HTTPSPort + PortOffset}</attribute> <attribute name="maxHttpHeaderSize">8192</attribute> <attribute name="maxThreads">150</attribute> <attribute name="minSpareThreads">25</attribute> <attribute name="maxSpareThreads">75</attribute> <attribute name="enableLookups">false</attribute> <attribute name="acceptCount">100</attribute> <attribute name="disableUploadTimeout">false</attribute> <attribute name="clientAuth">false</attribute> <attribute name="algorithm">Default</attribute> <attribute name="sslProtocol">TLS</attribute> <attribute name="keystoreFile">var/security/keystores/geronimo-default</attribute> <attribute name="keystorePass">secret</attribute> <attribute name="keystoreType">JKS</attribute> </gbean> <gbean name="TomcatHost"> <attribute name="initParams">name=${ServerHostname} appBase= workDir=work</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 propertyEditor="org.apache.geronimo.deployment.service.EnvironmentBuilder" name="corbaEnvironment"> <environment:environment xmlns:environment="http://geronimo.apache.org/xml/ns/deployment-1.2"> <environment:dependencies> <environment:dependency> <environment:groupId>org.apache.geronimo.configs</environment:groupId> <environment:artifactId>j2ee-corba-yoko</environment:artifactId> <environment:type>car</environment:type> </environment:dependency> </environment:dependencies> </environment: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 propertyEditor="org.apache.geronimo.deployment.service.EnvironmentBuilder" name="corbaEnvironment"> <environment:environment xmlns:environment="http://geronimo.apache.org/xml/ns/deployment-1.2"> <environment:dependencies> <environment:dependency> <environment:groupId>org.apache.geronimo.configs</environment:groupId> <environment:artifactId>client-corba-yoko</environment:artifactId> <environment:type>car</environment:type> </environment:dependency> </environment:dependencies> </environment:environment></attribute> </gbean> </module> <module name="org.apache.geronimo.configs/axis2/2.1/car"/> <module name="org.apache.geronimo.configs/jasper-deployer/2.1/car"/> <module name="org.apache.geronimo.configs/remote-deploy-tomcat/2.1/car"/> <module name="org.apache.geronimo.configs/client-security/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/client/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/axis2-ejb-deployer/2.1/car" condition="props['org.apache.geronimo.jaxws.provider'] == 'axis2' or (props['org.apache.geronimo.jaxws.provider'] == null and webcontainerName == 'tomcat6')"> <gbean name="Axis2ModuleBuilderExtension"> <attribute name="listener">?name=${webcontainer}</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/jaxws-ejb-deployer/2.1/car"/> <module name="org.apache.geronimo.configs/jaxws-deployer/2.1/car"/> <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> <attribute name="host">${ServerHostname}</attribute> <attribute name="port">${OpenEJBPort + PortOffset}</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/axis2-deployer/2.1/car" condition="props['org.apache.geronimo.jaxws.provider'] == 'axis2' or (props['org.apache.geronimo.jaxws.provider'] == null and webcontainerName == 'tomcat6')"/> <module name="org.apache.geronimo.configs/axis2-ejb/2.1/car"/> <module name="org.apache.geronimo.configs/ca-helper-tomcat/2.1/car"/> <module name="org.apache.geronimo.plugins/agent/2.1/car"/> <module name="org.apache.geronimo.plugins/agent-ds/2.1/car"/> <module name="org.apache.geronimo.configs/mejb/2.1/car"/> <module name="org.apache.geronimo.configs/tomcat6-clustering-builder-wadi/2.1/car"> <gbean name="TomcatClusteringBuilder"> <attribute name="defaultSweepInterval">${DefaultWadiSweepInterval}</attribute> <attribute name="defaultNumPartitions">${DefaultWadiNumPartitions}</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/tomcat6-deployer/2.1/car"/> <module name="org.apache.geronimo.configs/tomcat6-clustering-wadi/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/wadi-clustering/2.1/car" load="false"> <gbean name="DefaultBackingStrategyFactory"> <attribute name="nbReplica">${ReplicaCount}</attribute> </gbean> <gbean name="DefaultDispatcherHolder"> <attribute name="endPointURI">${EndPointURI}</attribute> <attribute name="clusterName">${ClusterName}</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/clustering/2.1/car"> <gbean name="Node"> <attribute name="nodeName">${clusterNodeName}</attribute> </gbean> </module> <module name="org.apache.geronimo.plugins/debugviews-console-tomcat/2.1/car"/> <module name="org.apache.geronimo.plugins/console-tomcat/2.1/car"/> <module name="org.apache.geronimo.plugins/pluto-support/2.1/car"/> <module name="org.apache.geronimo.configs/spring/2.1/car"/> <module name="org.apache.geronimo.configs/dojo-legacy-tomcat/2.1/car"/> <module name="org.apache.geronimo.configs/persistence-jpa10-deployer/2.1/car"> <gbean name="PersistenceUnitBuilder"> <attribute name="defaultPersistenceProviderClassName">org.apache.openjpa.persistence.PersistenceProviderImpl</attribute> <attribute name="defaultPersistenceUnitProperties">openjpa.Log=commons openjpa.jdbc.SynchronizeMappings=buildSchema(ForeignKeys=true) openjpa.jdbc.UpdateManager=operation-order openjpa.Sequence=table(Table=OPENJPASEQ, Increment=100)</attribute> <attribute propertyEditor="org.apache.geronimo.deployment.service.EnvironmentBuilder" name="defaultEnvironment"> <environment:environment xmlns:environment="http://geronimo.apache.org/xml/ns/deployment-1.2"> <environment:dependencies> <environment:dependency> <environment:groupId>org.apache.geronimo.configs</environment:groupId> <environment:artifactId>openjpa</environment:artifactId> <environment:type>car</environment:type> </environment:dependency> </environment:dependencies> </environment:environment></attribute> </gbean> </module> <module name="org.apache.geronimo.plugins/plugin-console-tomcat/2.1/car"/> <module name="org.apache.geronimo.plugins/plancreator-console-tomcat/2.1/car"/> <module name="org.apache.geronimo.framework/upgrade-cli/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/axis-deployer/2.1/car"> <gbean name="AxisModuleBuilderExtension"> <attribute name="listener">?name=${webcontainer}</attribute> <attribute propertyEditor="org.apache.geronimo.deployment.service.EnvironmentBuilder" name="defaultEnvironment"> <environment:environment xmlns:environment="http://geronimo.apache.org/xml/ns/deployment-1.2"> <environment:dependencies> <environment:dependency> <environment:groupId>org.apache.geronimo.configs</environment:groupId> <environment:artifactId>${webcontainerName}</environment:artifactId> <environment:type>car</environment:type> </environment:dependency> </environment:dependencies> </environment:environment></attribute> </gbean> </module> <module name="org.apache.geronimo.configs/j2ee-corba-yoko/2.1/car"> <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/hot-deployer/2.1/car"> <gbean name="HotDeployer"> <attribute name="path">deploy/</attribute> <attribute name="pollIntervalMillis">2000</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/farming/2.1/car" load="false"> <gbean name="NodeInfo"> <attribute name="name">${clusterNodeName}</attribute> </gbean> <gbean name="ClusterInfo"> <attribute name="name">${clusterName}</attribute> </gbean> </module> <module name="org.apache.geronimo.plugins/sysdb-console-tomcat/2.1/car"/> <module name="org.apache.geronimo.framework/offline-deployer/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/openejb-corba-deployer/2.1/car"/> <module name="org.apache.geronimo.plugins/activemq-console-tomcat/2.1/car"/> <module name="org.apache.geronimo.configs/client-corba-yoko/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/javamail/2.1/car"> <gbean name="SMTPTransport"> <attribute name="host">${SMTPHost}</attribute> <attribute name="port">${SMTPPort + PortOffset}</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/cxf-deployer/2.1/car" condition="props['org.apache.geronimo.jaxws.provider'] == 'cxf' or (props['org.apache.geronimo.jaxws.provider'] == null and webcontainerName == 'jetty6')"/> <module name="org.apache.geronimo.configs/cxf/2.1/car"/> <module name="org.apache.geronimo.configs/welcome-tomcat/2.1/car"/> <module name="org.apache.geronimo.configs/sharedlib/2.1/car"/> <module name="org.apache.geronimo.plugins/mconsole-tomcat/2.1/car"/> <module name="org.apache.geronimo.plugins/mconsole-ds/2.1/car"/> <module name="org.apache.geronimo.configs/client-deployer/2.1/car"/> <module name="org.apache.geronimo.configs/client-transaction/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/cxf-ejb-deployer/2.1/car" condition="props['org.apache.geronimo.jaxws.provider'] == 'cxf' or (props['org.apache.geronimo.jaxws.provider'] == null and webcontainerName == 'jetty6')"> <gbean name="CXFModuleBuilderExtension"> <attribute name="listener">?name=${webcontainer}</attribute> </gbean> </module> <module name="org.apache.geronimo.configs/cxf-ejb/2.1/car"/> <module name="org.apache.geronimo.configs/dojo-tomcat/2.1/car"/> <module name="org.apache.geronimo.configs/jsr88-ear-configurer/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/jsr88-jar-configurer/2.1/car" load="false"/> <module name="org.apache.geronimo.configs/jsr88-war-configurer/2.1/car" load="false"/> <module name="org.apache.geronimo.framework/jsr88-deploymentfactory/2.1/car" load="false"/> </attributes> {code} * |
Note:
...
Some
...
tags
...
in
...
the
...
config.xml
...
shown
...
above
...
are
...
presented
...
in
...
multiple
...
lines
...
for
...
displaying
...
purposes
...
only.
...
Declare
...
the
...
virtual
...
host
...
in
...
the
...
deployment
...
plan
...
As
...
mentioned
...
before,
...
for
...
this
...
example
...
we
...
are
...
using
...
the
...
HelloWorld
...
sample
...
application
...
covered
...
in
...
the
...
...
...
...
...
...
...
...
...
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
...
.
...
In
...
the
...
previous
...
section
...
we
...
defined
...
two
...
Virtual
...
Hosts,
...
now
...
we
...
will
...
be
...
configuring
...
two
...
applications
...
so
...
they
...
can
...
be
...
deployed
...
to
...
those
...
Virtual
...
Hosts
...
exclusively.
...
We
...
will
...
use
...
the
...
same
...
application
...
in
...
both
...
cases
...
but
...
will
...
differentiate
...
one
...
deployment
...
from
...
the
...
other
...
by
...
giving
...
it
...
a
...
different
...
artifactId
...
,
...
this
...
way
...
we
...
avoid
...
modifying
...
the
...
code
...
but
...
still
...
can
...
identify
...
each
...
deployment.
...
Assuming
...
you
...
followed
...
the
...
steps
...
covered
...
in
...
the
...
...
...
...
...
...
...
...
...
section
...
you
...
should
...
have
...
the
...
following
...
structure:
No Format | ||||
---|---|---|---|---|
| =
| |||
} <APP_HOME>\ + HelloWorld.jsp + WEB-INF\ + geronimo-web.xml + web.xml {noformat} |
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
...
on,
...
in
...
this
...
case
...
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.1</version> <type>war</type> </moduleId> </environment> <context-root>/hello_1</context-root> <host>virtualhost1.com</host> </web-app> {code} |
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.
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>
...
.
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.1</version> <type>war</type> </moduleId> </environment> <context-root>/hello_2</context-root> <host>virtualhost2.com</host> </web-app> {code} |
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:
deploy --user system --password manager deploy <APP_HOME>\HelloWorld_1.war
You should get a successful confirmation message similar to this one:
No Format | ||||
---|---|---|---|---|
| ||||
{*}}} You should get a successful confirmation message similar to this one: {noformat:borderStyle=solid| bgColor=#000000} D:\geronimo-tomcat6-jee5-2.1\bin>deploy --user system --password manager deploy \HelloWorld_2.1\HelloWorld_1.war Using GERONIMO_BASE: D:\geronimo-tomcat6-jee5-2.1 Using GERONIMO_HOME: D:\geronimo-tomcat6-jee5-2.1 Using GERONIMO_TMPDIR: var\temp Using JRE_HOME: C:\Java\jdk1.5.0_06\jre Deployed sample.applications/HelloWorldApp_1/2.1/war @ /hello_1 {noformat} {color:white} {color} Repeat the deployment for the second application. {{{*}deploy \--user system \--password manager deploy |
Repeat the deployment for the second application.
deploy --user system --password manager deploy <APP_HOME>\HelloWorld_2.war
You should get a successful confirmation message similar to this one:
No Format | ||||
---|---|---|---|---|
| ||||
{*}}} You should get a successful confirmation message similar to this one: {noformat:borderStyle=solid| bgColor=#000000} D:\geronimo-tomcat6-jee5-2.1\bin>deploy --user system --password manager deploy \HelloWorld_2.1\HelloWorld_2.war Using GERONIMO_BASE: D:\geronimo-tomcat6-jee5-2.1 Using GERONIMO_HOME: D:\geronimo-tomcat6-jee5-2.1 Using GERONIMO_TMPDIR: var\temp Using JRE_HOME: C:\Java\jdk1.5.0_06\jre Deployed sample.applications/HelloWorldApp_2/2.1/war @ /hello_2 {noformat} {color:white} {color} 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: || Host name / Virtual Host || Access || | [ |
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:
Host name / Virtual Host | Access |
---|---|
...
...
SUCCESS |
...
! |
...
! |
...
...
...
...
Fail |
Now repeat the tests for hello_2
...
.
...
Host |
---|
...
name |
---|
...
/ |
---|
...
Virtual |
---|
...
Host |
---|
...
...
...
...
SUCCESS |
...
! |
...
! |
...
...
SUCCESS |
...
! |
...
! |
...
...
SUCCESS |
...
! |
...
! |
...
! |
...
Congratulations
...
!
...
!
...
!
...
you
...
have
...
successfully
...
configured
...
and
...
deployed
...
two
...
applications
...
to
...
two
...
different
...
virtual
...
hosts
...
and
...
aliases.