----- Original Message -----

> From: Gabriele Faelli <gabriele.fae...@gmail.com>
> To: users@tomcat.apache.org
> 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" 
> <gabriele.fae...@gmail.com>
> 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="228.0.0.4"
>>  mcastPort="45564"
>>  mcastFrequency="500"
>>  mcastDropTime="3000"/>
>>  <Receiver
>>  className="org.apache.catalina.cluster.tcp.ReplicationListener"
>>  tcpListenAddress="192.168.199.101"
>>  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 java.io.Serializable

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

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.

<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 224.0.0.0/4 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"
    tempDir="${catalina.base}/temp-dir/"
    deployDir="${catalina.base}/webapps/"
    watchDir="${catalina.base}/watch-dir/"
    watchEnabled="true"/>

All other (client) nodes:

  <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
            tempDir="${catalina.base}/temp-dir/"
            deployDir="${catalina.base}/webapps/"
            watchDir="${catalina.base}/watch-dir/"
            watchEnabled="false"/>

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/logging.properties. This might help in figuring out what's going 
on.

Hope this helps.

. . . . just my two cents.
/mde/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to