tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Das, Sanjeev" <>
Subject problem with clustering using Tomcat 4.1
Date Fri, 27 Jun 2003 21:10:53 GMT
Hello Filip,

I have been trying to use your session replication libs in tomcat 4.1 and have run into problems.
I was wondering if you could help me out here. I am trying the replication with a simple jsp
page on a one box setup with two instances of tomcat running.

The jsp page simply prints out the session id and the cookies it has received. Here is the
text of the JSP page:

<%@ page import="javax.servlet.http.*" %>
Server: ONE

if (request.getSession().isNew())

This is a new session.

This is an old session.


The session id : <%=request.getSession().getId()%>


Cookie[] cookies = request.getCookies();
if (cookies != null)
	for (int i=0; i < cookies.length; i++)







The pages in the two instances are exactly the same except that one says SERVER ONE and the
other SERVER TWO so that I can distinguish between the two. I believe I have setup the Context
properly for both the instances. 

I am using Apache to do the round robin scheduling using mod_jk.

When I hit the page and look at the message in the two tomcat consoles I get the following:

first console:

[InMemoryReplicationManager] Replicated Session created at org.apache.catalina.c
luster.mcast.McastMember[tcp://,,4001] with ID=6B5C
[InMemoryReplicationManager] writeObject() storing session 6B5CF3C232D4D8636D145
[InMemoryReplicationManager] Replication Statistics
        Messages sent=2
        Message serialization time=31
        Average serialization time=15.5ms
        Average session send  size=805.0
        Messages received=0
        Message deserialization time=0
        Average deserialization time=NaNms
        Average message  delay  time=NaNms

second console:
[InMemoryReplicationManager] InMemoryReplicationManager.messageDataReceived(): r
eceived message
[InMemoryReplicationManager] Received SessionMessage of type=SESSION-CREATED
[InMemoryReplicationManager] Replicated session received ID=6B5CF3C232D4D8636D14
[InMemoryReplicationManager] readObject() loading session 6B5CF3C232D4D8636D1458
[InMemoryReplicationManager] Replicated session received=ReplicatedSession id=6B
5CF3C232D4D8636D14586083E0B094 ref=StandardSession[6B5CF3C232D4D8636D14586083E0B

[InMemoryReplicationManager] Replication Statistics
        Messages sent=1
        Message serialization time=16
        Average serialization time=16.0ms
        Average session send  size=491.0
        Messages received=2
        Message deserialization time=46
        Average deserialization time=23.0ms
        Average message  delay  time=15.5ms

It seems like the first box created the session and it was replicated properly in the second

Now when I reload the page and the request goes to the second box I would expect the same
session id to be printed out. Instead I get the following output from the jsp page:

Server: TWO 
This is a new session. 
The session id : E086477BF76F98820020F3FA7048C5E8 Cookies:

The second server did receive the right JSESSIONID (6B5CF3C232D4D8636D14586083E0B094) but
decided to create a new session instead of the replicated one.

Do you have any ideas as to why this occur?



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

View raw message