tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <>
Subject Re: problem with session replication in tomcat 5.5.23
Date Wed, 05 Oct 2011 18:21:51 GMT
----- Original Message -----

> From: Gabriele Faelli <>
> To:
> Cc: 
> Sent: Wednesday, October 5, 2011 1:17 AM
> Subject: Re: problem with session replication in tomcat 5.5.23
> Really any idea?
> Il giorno 04/ott/2011 19:13, "Gabriele Faelli" 
> <>
> ha scritto:
>>  Hi all,
>>  I'm running tomcat 5.5.23 on two RHEL 5.6.
>>  I'm having big trouble making the session replication working across 
> these
>>  two nodes.
>>  I configured a cluster and it looks like working: each node discovers the
>>  other one, I can see in the logs every received and transmitted ping.
>>  Well, when I create a session in the logs there are no mention of sessions
>>  being replicated and/or errors encounter while trying.
>>  The applications running on tomcat have the <distributable/> entry in
> their
>>  web.xml and this is the cluster config part of the server.xml:
>>  <Cluster 
> className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
>>  defaultMode="true"
> managerClassName="org.apache.catalina.cluster.session.DeltaManager"
>>  manager.expireSessionsOnShutdown="false"
>>  manager.useDirtyFlag="false"
>>  manager.notifyListenersOnReplication="true"
>>  manager.notifySessionListenersOnReplication="true"
>>  manager.sendAllSessions="true">
>>  <Membership
>>  className="org.apache.catalina.cluster.mcast.McastService"
>>  mcastAddr=""
>>  mcastPort="45564"
>>  mcastFrequency="500"
>>  mcastDropTime="3000"/>
>>  <Receiver
>>  className="org.apache.catalina.cluster.tcp.ReplicationListener"
>>  tcpListenAddress=""
>>  tcpListenPort="4001"
>>  tcpSelectorTimeout="100"
>>  tcpThreadCount="6"/>
>>  <Sender
> className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
>>  replicationMode="synchronous"
>>  ackTimeout="15000"
>>  waitForAck="true"
>>  autoConnect="true"/>
>>  <Valve
>>  className="org.apache.catalina.cluster.tcp.ReplicationValve"
> filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
>>  <Deployer
>>  className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
>>  tempDir="/tmp/war-temp/"
>>  deployDir="/tmp/war-deploy/"
>>  watchDir="/tmp/war-listen/"
>>  watchEnabled="false"/>
>>  <ClusterListener
> className="org.apache.catalina.cluster.session.ClusterSessionListener"/>
>>  </Cluster>
>>  Any Idea? Where I'm wrong? I did something stupid for sure :)
>>  I tried every configuration, suggest... well everything I found on the
>>  official an unofficial documentation... I'm quite frustated :P
>>  Thanks in advance
>>  G.

I'm by no means a clustering expert, and I've only run a 5.5.x (5.5.33) cluster on my local
machine (Fedora 15). I was going to work on improving the documentation (and my understanding),
but since EOL for the 5.5.x series is less than one year out that's fallen lower on my things
to do list.

A few things to check:

1. Make sure all your session objects implement

2. You have <distributable/> as the first line after <webapp> in your web.xml

3. Apparently (from the Tomcat documentation) when you override any of the defaults you 
   have to specify everything.

This has tripped me up in the past. I noticed for example that your configuration appears
to be missing a ClusterListener. Try adding the following line to your cluster configuration
after your other ClusterListener.

  className="org.apache.catalina.cluster.session.JvmRouteSessionIDBinderListener" />

4. Make sure that each Tomcat has a unique jvmRoute attribute on the Engine element

5. Make sure your firewall is not blocking new connections on your tcpListenPort

6. Make sure that you're set up for multicasting on the proper interface (which it
   sounds like you do)

So ifconfig <interface-name> should show in part: UP BROADCAST RUNNING MULTICAST
So ip route list should show something like: multicast dev eth0 scope link

7. Run something like Wireshark or tcpdump and watch for traffic on the tcpListenPort

Items 3 and 4 are for load balancing with AJP (think mod_ajp and Apache HTTPD), so I don't
know if it's necessary.

I'm not sure how the FarmDeployer works. I have mine set up so it functions, but there doesn't
seem to be any documentation. The javadoc doesn't seem to be internally consistent (I know,
patches welcome). I've set my FarmDeployer up as follows:

Admin (or source) node:

  <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"

All other (client) nodes:

  <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"

This seems to work (auto-deploy, etc.), except that when I restart the cluster all of the
applications in watchDir are deleted from deployDir and then redeployed.

Finally, you can get some more logging information by modifying $CATALINA_HOME/
This might help in figuring out what's going on.

Hope this helps.

. . . . just my two cents.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message