Versions Compared

Key

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

...

This example also demonstrates how to start listening on the ports after the web applications are fully deployed and ready to be used.

Tomcat example

In non-geronimo tomcat, you can do this by including two or more server definitions in your server.xml file, and including the applications in the server elements. It's possible to set up essentially the same structure in geronimo.

...

<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright 2004-2005 The Apache Software Foundation

Licensed 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: 395697 $ $Date: 2006-04-20 14:07:47 -0700 (Thu, 20 Apr 2006) $ -->

<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
<dep:moduleId>
<dep:groupId>geronimo</dep:groupId>
<dep:artifactId>appPerPort-tomcat</dep:artifactId>
<dep:version>1.1-SNAPSHOT</dep:version>
<dep:type>car</dep:type>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>geronimo</dep:groupId>
<dep:artifactId>tomcat</dep:artifactId>
<dep:type>car</dep:type>
</dep:dependency>
</dep:dependencies>
<dep:hidden-classes/>
<dep:non-overridable-classes/>
</dep:environment>

<module>
<web>war1.war</web>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
<context-priority-classloader>false</context-priority-classloader>
<web-container>
<gbean-link>TomcatWebContainer1</gbean-link>
</web-container>
</web-app>
</module>

<module>
<web>war2.war</web>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
<context-priority-classloader>false</context-priority-classloader>
<web-container>
<gbean-link>TomcatWebContainer2</gbean-link>
</web-container>
</web-app>
</module>

<module>
<web>connectors.war</web>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1">
<context-priority-classloader>false</context-priority-classloader>
<gbean name="TomcatWebConnector1" class="org.apache.geronimo.tomcat.ConnectorGBean">
<attribute name="name">HTTP</attribute>
<attribute name="host">localhost</attribute>
<attribute name="port">8081</attribute>
<attribute name="maxHttpHeaderSizeBytes">8192</attribute>
<attribute name="maxThreads">150</attribute>
<attribute name="minSpareThreads">25</attribute>
<attribute name="maxSpareThreads">75</attribute>
<attribute name="hostLookupEnabled">false</attribute>
<attribute name="redirectPort">8453</attribute>
<attribute name="acceptQueueSize">100</attribute>
<attribute name="connectionTimeoutMillis">20000</attribute>
<attribute name="uploadTimeoutEnabled">false</attribute>
<reference name="TomcatContainer">
<name>TomcatWebContainer1</name>
</reference>
</gbean>

<gbean name="TomcatWebConnector2" class="org.apache.geronimo.tomcat.ConnectorGBean">
<attribute name="name">HTTP</attribute>
<attribute name="host">localhost</attribute>
<attribute name="port">8082</attribute>
<attribute name="maxHttpHeaderSizeBytes">8192</attribute>
<attribute name="maxThreads">150</attribute>
<attribute name="minSpareThreads">25</attribute>
<attribute name="maxSpareThreads">75</attribute>
<attribute name="hostLookupEnabled">false</attribute>
<attribute name="redirectPort">8453</attribute>
<attribute name="acceptQueueSize">100</attribute>
<attribute name="connectionTimeoutMillis">20000</attribute>
<attribute name="uploadTimeoutEnabled">false</attribute>
<reference name="TomcatContainer">
<name>TomcatWebContainer2</name>
</reference>
</gbean>

</web-app>
</module>

<gbean name="TomcatWebContainer1" class="org.apache.geronimo.tomcat.TomcatContainer">
<attribute name="catalinaHome">var/catalina</attribute>
<reference name="EngineGBean">
<name>TomcatEngine1</name>
</reference>
<reference name="ServerInfo">
<name>ServerInfo</name>
</reference>
<reference name="WebManager">
<name>TomcatWebManager</name>
</reference>
</gbean>

<gbean name="TomcatEngine1" class="org.apache.geronimo.tomcat.EngineGBean">
<attribute name="className">org.apache.geronimo.tomcat.TomcatEngine</attribute>
<attribute name="initParams">
name=Geronimo1
</attribute>
<reference name="DefaultHost">
<name>TomcatHost1</name>
</reference>
<references name="Hosts">
<pattern>
<name>TomcatHost1</name>
</pattern>
</references>
<reference name="RealmGBean">
<name>TomcatJAASRealm</name>
</reference>
</gbean>

<gbean name="TomcatHost1" class="org.apache.geronimo.tomcat.HostGBean">
<attribute name="className">org.apache.catalina.core.StandardHost</attribute>
<attribute name="initParams">
name=localhost
appBase=
workDir=work
</attribute>
</gbean>

<gbean name="TomcatWebContainer2" class="org.apache.geronimo.tomcat.TomcatContainer">
<attribute name="catalinaHome">var/catalina</attribute>
<reference name="EngineGBean">
<name>TomcatEngine2</name>
</reference>
<reference name="ServerInfo">
<name>ServerInfo</name>
</reference>
<reference name="WebManager">
<name>TomcatWebManager</name>
</reference>
</gbean>

<gbean name="TomcatEngine2" class="org.apache.geronimo.tomcat.EngineGBean">
<attribute name="className">org.apache.geronimo.tomcat.TomcatEngine</attribute>
<attribute name="initParams">
name=Geronimo2
</attribute>
<reference name="DefaultHost">
<name>TomcatHost2</name>
</reference>
<references name="Hosts">
<pattern>
<name>TomcatHost2</name>
</pattern>
</references>
<reference name="RealmGBean">
<name>TomcatJAASRealm</name>
</reference>
</gbean>

<gbean name="TomcatHost2" class="org.apache.geronimo.tomcat.HostGBean">
<attribute name="className">org.apache.catalina.core.StandardHost</attribute>
<attribute name="initParams">
name=localhost
appBase=
workDir=work
</attribute>
</gbean>

</application>

Jetty

Jetty web apps have the same ability to specify which jetty container should be used, however I don't have a sample plan to demonstrate that it works.

...