title: session replication and clustering in tomcat?
body: <p>I have configured the <code>HttpServer2.2</code> to achieve the <code>load balancing</code> and the <code>Clustering</code>for my java application.</p>
  
  <p>But the <code>Load Balancing</code> works fine and <code>Clustering(session replication)</code> not works .</p>
  
  <p>My <code>worker.properties</code> in <code>HttpServer</code> will be ,</p>
  
  <pre><code>workers.java_home=C:/Program Files/Java/jdk1.6.0_25
  
  #worker.list=worker1,worker2
  worker.list=balancer
  
  worker.worker1.port=8009
  worker.worker1.host=localhost
  worker.worker1.type=ajp13
  worker.worker1.lbfactor=1
  
  worker.worker2.port=8019
  worker.worker2.host=192.168.100.84
  worker.worker2.type=ajp13
  worker.worker2.lbfactor=1
  
  worker.balancer.type=lb
  worker.balancer.balance_workers=worker1,worker2
  worker.balancer.method=B
  # Specifies whether requests with SESSION ID's 
  # should be routed back to the same #Tomcat worker.
  worker.balancer.sticky_session =True
  </code></pre>
  
  <p>and the <code>httpd.conf</code> will be,</p>
  
  <pre><code>&lt;IfModule jk_module&gt;
  
  JkWorkersFile conf/workers.properties
  JkLogFile logs/mod_jk.log
  JkLogLevel info
  
  JkMount /CustomerChat_V1.02.00 balancer
  JkMount /CustomerChat_V1.02.00/* balance
  
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>In my <code>server.xml</code> for <code>Tomcat one</code>,</p>
  
  <pre><code>&lt;Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
       channelSendOptions="8"&gt;
       &lt;Manager className="org.apache.catalina.ha.session.DeltaManager"
            expireSessionsOnShutdown="false"
            notifyListenersOnReplication="true"/&gt;
  
       &lt;Channel className="org.apache.catalina.tribes.group.GroupChannel"&gt;
  
          &lt;Membership className="org.apache.catalina.tribes.membership.McastService"
              address="228.0.0.8"
  
              port="45564"
              frequency="500"
              dropTime="3000" /&gt;
  
          &lt;Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                address="auto"
                port="4200"
                autoBind="100"
                selectorTimeout="5000"
                maxThreads="6" /&gt;
  
          &lt;Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"&gt;
          &lt;Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/&gt; 
          &lt;/Sender&gt;
  
          &lt;Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/&gt;
  
          &lt;Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/&gt;
  
       &lt;/Channel&gt;
       &lt;Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
          filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;" /&gt;
  
       &lt;Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
             tempDir="D:/cluster/temp/war-temp/"
             deployDir="D:/cluster/temp/war-deploy/"
             watchDir="D:/cluster/temp/war-listen/"
             watchEnabled="false" /&gt;
  
       &lt;ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/&gt;
  
       &lt;ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/&gt;
  &lt;/Cluster&gt;
  </code></pre>
  
  <p>In my <code>server.xml</code> for <code>Tomcat two</code>,</p>
  
  <pre><code>       &lt;Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                    address="192.168.0.1"
                    port="4100"
                    autoBind="100"
                    selectorTimeout="5000"
                    maxThreads="6" /&gt;
  </code></pre>
  
  <p>But Still having the problem.</p>
  
  <p>When I shutdown the <code>Tomcat one</code> ,the new request will be automatically goes to the <code>tomcat two</code>. But the <code>Tomcat two</code> doesn't know about the current user state and his stored session object of the application.</p>
  
  <p>hope our stack members will help me with this.</p>
  
  <p>Good answers are definitely appreciated.</p>