tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Angus Mezick" <amez...@guidestar.org>
Subject RE: problem with clustering using Tomcat 4.1
Date Mon, 30 Jun 2003 11:57:42 GMT
Check the name of the cookie, the host of the cookie, and the path of
the cookie.  ESP the path and the host of the cookie.  These things need
to match.  Netscape 7 also have a LiveHTTPHeaders plugin at mozdev.org
that is REALLY helpful for debugging this stuff.

> -----Original Message-----
> From: Das, Sanjeev [mailto:Sanjeev.Das@kanisa.com] 
> Sent: Friday, June 27, 2003 5:11 PM
> To: mail@filip.net
> Cc: tomcat-user@jakarta.apache.org
> Subject: problem with clustering using Tomcat 4.1
> 
> 
> 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.*" %>
> <HTML>
> <BODY>
> Server: ONE
> <p/>
> 
> 
> <%
> if (request.getSession().isNew())
> {
> %>
> 
> This is a new session.
> 
> <%
> }
> else
> {
> %>
> This is an old session.
> <%
> }
> %>
> 
> <p/>
> 
> The session id : <%=request.getSession().getId()%>
> 
> 
> <b>Cookies:</b><br/>
> 
> <%
> Cookie[] cookies = request.getCookies();
> if (cookies != null)
> {
> 	for (int i=0; i < cookies.length; i++)
> 	{
> 	%>
> 
> 	<b>Domain:</b><br/>
> 	<%=cookies[i].getDomain()%><br/>
> 
> 	<b>Name:</b><br/>
> 	<%=cookies[i].getName()%><br/>
> 
> 	<b>Value:</b><br/>
> 	<%=cookies[i].getValue()%><br/>
> 
> 	<b>Path:</b><br/>
> 	<%=cookies[i].getPath()%><br/>
> 
> 	<b>MaxAge:</b><br/>
> 	<%=cookies[i].getMaxAge()%><br/>
> 
> 
> 	<%
> 	}
> }
> %>
> </BODY>
> </HTML>
> 
> 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://172.17.1.106:4001,172.17.1.106,
> 4001] with ID=6B5C
> F3C232D4D8636D14586083E0B094
> [InMemoryReplicationManager] writeObject() storing session 
> 6B5CF3C232D4D8636D145
> 86083E0B094
> [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
> 586083E0B094
> [InMemoryReplicationManager] readObject() loading session 
> 6B5CF3C232D4D8636D1458
> 6083E0B094
> [InMemoryReplicationManager] Replicated session 
> received=ReplicatedSession id=6B
> 5CF3C232D4D8636D14586083E0B094 
> ref=StandardSession[6B5CF3C232D4D8636D14586083E0B
> 094]
>         LastAccess=1056747084419
> 
> [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 box.
> 
> 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:
> Domain:
> null
> Name:
> JSESSIONID
> Value:
> 6B5CF3C232D4D8636D14586083E0B094
> Path:
> null
> MaxAge:
> -1
> 
> 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?
> 
> thanks
> 
> Sanjeev
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message