aspose file tools*
The moose likes Tomcat and the fly likes Tomcat 6 Cluster Woes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 6 Cluster Woes" Watch "Tomcat 6 Cluster Woes" New topic
Author

Tomcat 6 Cluster Woes

Zac Zachariah
Greenhorn

Joined: Aug 04, 2008
Posts: 1
Hi,

I am trying to set up a cluster of tomcat servers to serve up my dynamic content with session replication. Although failover seems to be working with each node aware of the other, Session replication does not work quite as expected. I get the error "WARNING: Context manager doesn't exist" warning. For testing I use the Sessions example in the examples web application of the tomcat distribtion. Although I see session variables created through one node the other node does not receive the variables.

Here is how I have set up the nodes:

Zither: NFS server serving apache/tomcat binaries and config files
Z2: node1 running Apache 2.2 and Tomcat 6
Z3: node2 running Apache 2.2 and Tomcat 6

Load balancer: mod_jk
CATALINA_BASE: /usr/local/tomcat/<node name>
CATALINA_HOME: /usr/local/tomcat

Each node has its own config and logs directory under CATALINA_BASE

My server.xml file with cluser section shown:

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="8">
<!--
<Manager className="org.apache.catalina.ha.session.BackupManager"
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"
mapSendOptions="6"/>
-->
<Manager className="org.apache.catalina.ha.session.DeltaManager"
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"/>

<Channel className="org.apache.catalina.tribes.group.GroupChannel">
<Membership className="org.apache.catalina.tribes.membership.McastService"
address="228.0.0.4"
port="45564"
frequency="500"
dropTime="3000"/>
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="z2"
port="5000"
selectorTimeout="100"
maxThreads="6"/>

<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
</Sender>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/>
</Channel>

<Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

<!--
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
-->

<ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>




Here are the snippets from the Catalina.out log files of Z1 and Z2

From NODE Z2

Aug 1, 2008 12:09:11 PM org.apache.catalina.ha.session.DeltaManager start
INFO: Starting clustering manager at /manager
Aug 1, 2008 12:09:11 PM org.apache.catalina.ha.session.DeltaManager getAllClusterSessions
INFO: Manager [z2#/manager]: skipping state transfer. No members active in cluster group.
Aug 1, 2008 12:09:11 PM org.apache.catalina.ha.session.JvmRouteBinderValve start
INFO: JvmRouteBinderValve started
Aug 1, 2008 12:09:11 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Aug 1, 2008 12:09:11 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Aug 1, 2008 12:09:11 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/34 config=null
Aug 1, 2008 12:09:11 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3552 ms
Aug 1, 2008 12:13:25 PM org.apache.catalina.tribes.io.BufferPool getBufferPool
INFO: Created a buffer pool with max size:104857600 bytes of typerg.apache.catalina.tribes.io.BufferPool15Impl
Aug 1, 2008 12:13:25 PM org.apache.catalina.ha.tcp.SimpleTcpCluster memberAdded
INFO: Replication member addedrg.apache.catalina.tribes.membership.MemberImpl[tcp://z3:5000,z3,5000, alive=1015,id={111 -85 -38 -109 -29 -125 69 -7
1 -118 121 71 35 86 80 86 20 }, payload={}, command={}, domain={}, ]
Aug 1, 2008 12:13:27 PM org.apache.catalina.ha.session.ClusterSessionListener messageReceived
WARNING: Context manager doesn't exist:z3#/TestWebApp
Aug 1, 2008 12:14:27 PM org.apache.catalina.ha.session.ClusterSessionListener messageReceived
WARNING: Context manager doesn't exist:z3#/examples
Aug 1, 2008 12:15:27 PM org.apache.catalina.ha.session.ClusterSessionListener messageReceived
WARNING: Context manager doesn't exist:z3#/CVS
Aug 1, 2008 12:16:27 PM org.apache.catalina.ha.session.ClusterSessionListener messageReceived
WARNING: Context manager doesn't exist:z3#/manager
Aug 1, 2008 5:20:09 PM org.apache.catalina.ha.session.ClusterSessionListener messageReceived
WARNING: Context manager doesn't exist:z3#/examples
Aug 1, 2008 5:20:29 PM org.apache.catalina.ha.session.ClusterSessionListener messageReceived
WARNING: Context manager doesn't exist:z3#/examples
Aug 1, 2008 5:21:12 PM org.apache.catalina.ha.session.ClusterSessionListener messageReceived
WARNING: Context manager doesn't exist:z3#/examples
Aug 1, 2008 5:51:47 PM org.apache.catalina.ha.session.ClusterSessionListener messageReceived
WARNING: Context manager doesn't exist:z3#/examples
Aug 4, 2008 9:33:52 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: sessionCreated('F3BFE5345E7EE26DEA2409E01B06BE0A.z2')
Aug 4, 2008 9:33:52 AM org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor report
INFO: ThroughputInterceptor Report[
Tx Msg:1 messages
Sent:0.00 MB (total)
Sent:0.00 MB (application)
Time:0.01 seconds
Tx Speed:0.07 MB/sec (total)
TxSpeed:0.07 MB/sec (application)
Error Msg:0
Rx Msg:9 messages
Rx Speed:0.00 MB/sec (since 1st msg)
Received:0.00 MB]




FROM NODE Z3 (session variables are created through this node)

Aug 1, 2008 12:13:23 PM org.apache.catalina.ha.tcp.SimpleTcpCluster setProperty
WARNING: Dynamic setProperty(className,value) has been disabled, please use explicit properties for the element you are trying to identify
Aug 1, 2008 12:13:24 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Aug 1, 2008 12:13:24 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1099 ms
Aug 1, 2008 12:13:24 PM org.apache.catalina.users.MemoryUserDatabase save
WARNING: User database is not persistable - no write permissions on directory
Aug 1, 2008 12:13:24 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 1, 2008 12:13:24 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0-snapshot
Aug 1, 2008 12:13:24 PM org.apache.catalina.ha.tcp.SimpleTcpCluster start
INFO: Cluster is about to start
Aug 1, 2008 12:13:24 PM org.apache.catalina.tribes.transport.ReceiverBase bind
INFO: Receiver Server Socket bound to:z3/192.168.0.3:5000
Aug 1, 2008 12:13:24 PM org.apache.catalina.tribes.membership.McastServiceImpl setupSocket
INFO: Setting cluster mcast soTimeout to 500
Aug 1, 2008 12:13:24 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:4
Aug 1, 2008 12:13:25 PM org.apache.catalina.ha.tcp.SimpleTcpCluster memberAdded
INFO: Replication member addedrg.apache.catalina.tribes.membership.MemberImpl[tcp://z2:5000,z2,5000, alive=256519,id={-99 -73 116 5 29 -120 69 124
-70 106 64 -72 -2 -118 -116 96 }, payload={}, command={}, domain={}, ]
Aug 1, 2008 12:13:25 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Done sleeping, membership established, start level:4
Aug 1, 2008 12:13:25 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:8
Aug 1, 2008 12:13:25 PM org.apache.catalina.tribes.io.BufferPool getBufferPool
INFO: Created a buffer pool with max size:104857600 bytes of typerg.apache.catalina.tribes.io.BufferPool15Impl
Aug 1, 2008 12:13:26 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
INFO: Done sleeping, membership established, start level:8
Aug 1, 2008 12:13:27 PM org.apache.catalina.ha.session.DeltaManager start
INFO: Register manager /TestWebApp to cluster element Engine with name Catalina
Aug 1, 2008 12:13:27 PM org.apache.catalina.ha.session.DeltaManager start
INFO: Starting clustering manager at /TestWebApp
Aug 1, 2008 12:13:27 PM org.apache.catalina.ha.session.DeltaManager getAllClusterSessions
WARNING: Manager [z3#/TestWebApp], requesting session state from org.apache.catalina.tribes.membership.MemberImpl[tcp://z2:5000,z2,5000, alive=258559
,id={-99 -73 116 5 29 -120 69 124 -70 106 64 -72 -2 -118 -116 96 }, payload={}, command={}, domain={}, ]. This operation will timeout if no session s
tate has been received within 60 seconds.
Aug 1, 2008 12:13:27 PM org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor report
INFO: ThroughputInterceptor Report[
Tx Msg:1 messages
Sent:0.00 MB (total)
Sent:0.00 MB (application)
Time:0.01 seconds
Tx Speed:0.07 MB/sec (total)
TxSpeed:0.07 MB/sec (application)
Error Msg:0
Rx Msg:1 messages
Rx Speed:0.00 MB/sec (since 1st msg)
Received:0.00 MB]
:$
SEVERE: Manager [z3#/manager]: No session state send at 8/1/08 12:16 PM received, timing out after 60,007 ms.
Aug 1, 2008 12:17:27 PM org.apache.catalina.ha.session.JvmRouteBinderValve start
INFO: JvmRouteBinderValve started
Aug 1, 2008 12:17:27 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Aug 1, 2008 12:17:28 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8010
Aug 1, 2008 12:17:28 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/34 config=null
Aug 1, 2008 12:17:28 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 243934 ms
Aug 1, 2008 5:20:09 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: sessionCreated('949E5DEEB498834B9312D3076C2687CE.z3')
Aug 1, 2008 5:20:29 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: attributeAdded('949E5DEEB498834B9312D3076C2687CE.z3', 'zkzac', '123')
Aug 1, 2008 5:21:12 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: attributeAdded('949E5DEEB498834B9312D3076C2687CE.z3', 'bob', '321')
Aug 1, 2008 5:51:47 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: sessionDestroyed('949E5DEEB498834B9312D3076C2687CE.z3')
Aug 1, 2008 5:51:47 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: attributeRemoved('949E5DEEB498834B9312D3076C2687CE.z3', 'bob', '321')
Aug 1, 2008 5:51:47 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: attributeRemoved('949E5DEEB498834B9312D3076C2687CE.z3', 'zkzac', '123')
Aug 4, 2008 9:33:52 AM org.apache.catalina.ha.session.ClusterSessionListener messageReceived
WARNING: Context manager doesn't exist:z2#/examples







I would be very grateful is someone who have set up a working cluster on Tomcat 6 throw some light on where I could have gone wrong.

Thanks much.

--Zac
Robin Wilson
Greenhorn

Joined: May 10, 2006
Posts: 22
I was having a similar problem, and in reading through posts (by the same user as the original note on this post), found that he fixed his problem by changing the '<Host name=...' on his config to be 'localhost')... Well, I had a similar problem, except my Host entry already had 'localhost', and my error was:

WARNING: Context manager doesn't exist:localhost#/><webapp_name>

After verifying that the web.xml in the webapp has the <distributable/> tag (it does), and we use the same '.war' file on each host in the cluster, I was stumped.

Also, a note about my setup - I was only getting the WARNING on _1_ host out of my 2-host cluster.

Anyway, I think I figured out the problem - and thought I would document here in case anyone else is searching for a solution.

1) Our setup uses multiple webapps in our cluster of tomcats. However, only 1 webapp is using session replication - so the rest don't setup to use the cluster manager.
2) If one of the hosts starts up first, it deploys the 'clusterable' webapp before the other host. But the other host starts it's cluster manager and gets a request for the session state of "localhost/<webapp>"... So it throws the WARNING message to alert the local tomcat to the fact that it's being asked for session state on a webapp that it doesn't have (yet). After the server completes startup, this problem goes away, because the webapp eventually gets deployed - and the session state is available to be replicated normally. (Doh!)

To eliminate the erroneous warning messages (for our production environment - no errors/warnings is "good" if they aren't worth worrying about), we added the following 2 lines to our 'logging.properties' (we're using the JULI logger) file:

org.apache.catalina.ha.session.ClusterSessionListener.level = SEVERE
org.apache.catalina.ha.session.ClusterSessionListener.handlers = 2localhost.org.apache.juli.FileHandler

This sets the ClusterSessionListener class to report only 'SEVERE' errors instead of a bunch of useless WARNING level messages.

FYI, we're using tomcat 6.0.18.


--<br />Robin D. Wilson
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat 6 Cluster Woes