Versions Compared

Key

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

...

If you want to deploy your Web application to a cluster, install your WAR files to the appropriate cluster member, assuring that you use the correct deployment plan for each member. Here is the template for your Web application deployment plan

  • Sample geronimo-web.xml for geronimo 2.1.4 and below
    Code Block
    XML
    XML
    borderStylesolid
    titlegeronimo-web.xml
    
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1"
             xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
    
        <dep:environment>
            <dep:moduleId>
            <dep:groupId>org.mygroup</dep:groupId>
            <dep:artifactId>web-cluster-server1</dep:artifactId>
            <dep:version>2.1.1.2</dep:version>
            <dep:type>war</dep:type>
            </dep:moduleId>
            <dep:dependencies/>
            <dep:hidden-classes/>
            <dep:non-overridable-classes/>
        </dep:environment>
    
        <context-root>/servlet-examples-cluster</context-root>
    
        <security-realm-name>geronimo-properties-realm</security-realm-name>
        <security>
            <default-principal>
            <principal name="anonymous" class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal"/>
          </default-principal>
          <role-mappings>
            <role role-name="tomcat">
              <principal name="admin" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
            </role>
          </role-mappings>
        </security>
    
        <cluster>TomcatCluster</cluster>
        <gbean class="org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean" name="TomcatCluster">
            <attribute name="className">org.apache.catalina.ha.tcp.SimpleTcpCluster</attribute>
            <attribute name="initParams">
                managerClassName=org.apache.catalina.ha.session.DeltaManager
                expireSessionsOnShutdown=false
                useDirtyFlag=true
                notifyListenersOnReplication=true
            </attribute>
            <reference name="TomcatValveChain">
                <name>ReplicationValve</name>
            </reference>
            <reference name="ClusterListenerChain">
                <name>ClusterSessionListener</name>
            </reference>
            <reference name="Channel">
                <name>TomcatGroupChannel</name>
            </reference>
        </gbean>
        <gbean class="org.apache.geronimo.tomcat.cluster.ChannelGBean" name="TomcatGroupChannel">
            <attribute name="className">org.apache.catalina.tribes.group.GroupChannel</attribute>
            <attribute name="initParams"/>
            <reference name="Membership">
                <name>TomcatMembership</name>
            </reference>
            <reference name="Receiver">
                <name>TomcatReceiver</name>
            </reference>
            <reference name="Sender">
                <name>TomcatSender</name>
            </reference>
            <reference name="ChannelInterceptor">
                <name>TomcatChannelInterceptor</name>
            </reference>
        </gbean>
        <gbean class="org.apache.geronimo.tomcat.cluster.MembershipServiceGBean" name="TomcatMembership">
            <attribute name="className">org.apache.catalina.tribes.membership.McastService</attribute>
            <attribute name="initParams">
                mcastAddr=228.0.0.4
                mcastPort=45564
                mcastFrequency=500
                mcastDropTime=3000
            </attribute>
        </gbean>
        <gbean class="org.apache.geronimo.tomcat.cluster.ReceiverGBean" name="TomcatReceiver">
            <attribute name="className">org.apache.catalina.tribes.transport.nio.NioReceiver</attribute>
            <attribute name="initParams">
                tcpListenAddress=IPAddressIn
                tcpListenPort=4001
                tcpSelectorTimeout=100
                tcpThreadCount=6
            </attribute>
        </gbean>
        <gbean class="org.apache.geronimo.tomcat.cluster.SenderGBean" name="TomcatSender">
            <attribute name="className">org.apache.catalina.tribes.transport.ReplicationTransmitter</attribute>
            <attribute name="initParams">
                replicationMode=pooled
                waitForAck=true
            </attribute>
        </gbean>
        <gbean class="org.apache.geronimo.tomcat.ValveGBean" name="ReplicationValve">
            <attribute name="className">org.apache.catalina.ha.tcp.ReplicationValve</attribute>
            <attribute name="initParams">filter=.*\.gif;.*\.js;.*\.css;.*\.png;.*\.jpeg;.*\.jpg;.*\.htm;.*\.html;.*\.txt;</attribute>
            <reference name="NextValve">
                <name>JvmRouteBinderValve</name>
            </reference>
        </gbean>
        <gbean class="org.apache.geronimo.tomcat.ValveGBean" name="JvmRouteBinderValve">
            <attribute name="className">org.apache.catalina.ha.session.JvmRouteBinderValve</attribute>
            <attribute name="initParams">enabled=true</attribute>
        </gbean>
        <gbean class="org.apache.geronimo.tomcat.cluster.ClusterListenerGBean" name="ClusterSessionListener">
            <attribute name="className">org.apache.catalina.ha.session.ClusterSessionListener</attribute>
            <reference name="NextListener">
                <name>JvmRouteSessionIDBinderListener</name>
            </reference>
        </gbean>
        <gbean class="org.apache.geronimo.tomcat.cluster.ClusterListenerGBean" name="JvmRouteSessionIDBinderListener">
            <attribute name="className">org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener</attribute>
        </gbean>
        <gbean class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean" name="TomcatChannelInterceptor">
            <attribute name="className">org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</attribute>
        </gbean>
    </web-app>
    
  • Sample geronimo-web.xml for geronimo versions above 2.1.4. This does not include g 2.2
    After applying fix to 2.1 through GERONIMO-4187 there are some modifications which needs to picked up by your configuration through geronimo-web.xml
Code Block
XML
XML
borderStylesolid
titlegeronimo-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-2.0.1"
         xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">

    <dep:environment>
        <dep:moduleId>
        <dep:groupId>org.mygroup</dep:groupId>
        <dep:artifactId>web-cluster-server1</dep:artifactId>
        <dep:version>2.1.1.2</dep:version>
        <dep:type>war</dep:type>
        </dep:moduleId>
        <dep:dependencies/>
        <dep:hidden-classes/>
        <dep:non-overridable-classes/>
    </dep:environment>

    <context-root>/servlet-examples-cluster</context-root>

    <security-realm-name>geronimo-properties-realm</security-realm-name>
    <security>
        <default-principal>
        <principal name="anonymous" class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal"/>
      </default-principal>
      <role-mappings>
        <role role-name="tomcat">
          <principal name="admin" class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
        </role>
      </role-mappings>
    </security>

    <cluster>TomcatCluster</cluster>
    <gbean class="org.apache.geronimo.tomcat.cluster.CatalinaClusterGBean" name="TomcatCluster">
        <attribute name="className">org.apache.catalina.ha.tcp.SimpleTcpCluster</attribute>
        <attribute name="initParams"/>
        <reference name="TomcatValveChain">
            <name>ReplicationValve</name>
        </reference>
        <reference name="ClusterListenerChain">
            <name>ClusterSessionListener</name>
        </reference>
        <reference name="Channel">
            <name>TomcatGroupChannel</name>
        </reference>
        <reference name="ClusterManager">                 
                 <name>TomcatClusterManager</name>
         </reference>                             
    </gbean>
<gbean name="TomcatClusterManager"                                   
class="org.apache.geronimo.tomcat.cluster.ClusterManagerGBean">         
            <attribute                                                  
name="className">org.apache.catalina.ha.session.DeltaManager</attribute>
            <attribute name="initParams">name=somename                  
          expireSessionsOnShutdown=false                                
                                         useDirtyFlag=true              
                                                                        
notifyListenersOnReplication=true                                       
            </attribute>                                                
        </gbean>                                                        

    <gbean class="org.apache.geronimo.tomcat.cluster.ChannelGBean" name="TomcatGroupChannel">
        <attribute name="className">org.apache.catalina.tribes.group.GroupChannel</attribute>
        <attribute name="initParams"/>
        <reference name="Membership">
            <name>TomcatMembership</name>
        </reference>
        <reference name="Receiver">
            <name>TomcatReceiver</name>
        </reference>
        <reference name="Sender">
            <name>TomcatSender</name>
        </reference>
        <reference name="ChannelInterceptor">
            <name>TomcatChannelInterceptor</name>
        </reference>
    </gbean>
    <gbean class="org.apache.geronimo.tomcat.cluster.MembershipServiceGBean" name="TomcatMembership">
        <attribute name="className">org.apache.catalina.tribes.membership.McastService</attribute>
        <attribute name="initParams">
            mcastAddr=228.0.0.4
            mcastPort=45564
            mcastFrequency=500
            mcastDropTime=3000
        </attribute>
    </gbean>
    <gbean class="org.apache.geronimo.tomcat.cluster.ReceiverGBean" name="TomcatReceiver">
        <attribute name="className">org.apache.catalina.tribes.transport.nio.NioReceiver</attribute>
        <attribute name="initParams">
            tcpListenAddress=IPAddressIn
            tcpListenPort=4001
            tcpSelectorTimeout=100
            tcpThreadCount=6
        </attribute>
    </gbean>
    <gbean class="org.apache.geronimo.tomcat.cluster.SenderGBean" name="TomcatSender">
        <attribute name="className">org.apache.catalina.tribes.transport.ReplicationTransmitter</attribute>
        <attribute name="initParams">
            replicationMode=pooled
            waitForAck=true
        </attribute>
    </gbean>
    <gbean class="org.apache.geronimo.tomcat.ValveGBean" name="ReplicationValve">
        <attribute name="className">org.apache.catalina.ha.tcp.ReplicationValve</attribute>
        <attribute name="initParams">filter=.*\.gif;.*\.js;.*\.css;.*\.png;.*\.jpeg;.*\.jpg;.*\.htm;.*\.html;.*\.txt;</attribute>
        <reference name="NextValve">
            <name>JvmRouteBinderValve</name>
        </reference>
    </gbean>
    <gbean class="org.apache.geronimo.tomcat.ValveGBean" name="JvmRouteBinderValve">
        <attribute name="className">org.apache.catalina.ha.session.JvmRouteBinderValve</attribute>
        <attribute name="initParams">enabled=true</attribute>
    </gbean>
    <gbean class="org.apache.geronimo.tomcat.cluster.ClusterListenerGBean" name="ClusterSessionListener">
        <attribute name="className">org.apache.catalina.ha.session.ClusterSessionListener</attribute>
        <reference name="NextListener">
            <name>JvmRouteSessionIDBinderListener</name>
        </reference>
    </gbean>
    <gbean class="org.apache.geronimo.tomcat.cluster.ClusterListenerGBean" name="JvmRouteSessionIDBinderListener">
        <attribute name="className">org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener</attribute>
    </gbean>
    <gbean class="org.apache.geronimo.tomcat.cluster.ChannelInterceptorGBean" name="TomcatChannelInterceptor">
        <attribute name="className">org.apache.catalina.tribes.group.interceptors.TcpFailureDetector</attribute>
    </gbean>
</web-app>

...