How do you distinguish between the two servers in your URL?

For the clustering to work you need to hit both through a single entry point 
such as a load balancer.

This is because the session id is stored as a cookie which is stuck to a 
hostname, an inherent cookie behaivour. If when you hit the second server you 
just change the hostname in your URL then this is never going to work.

Ta
Matt

-----Original Message-----
From: Nandish Rudra [mailto:[EMAIL PROTECTED]
Sent: 02 December 2004 22:40
To: 'Tomcat Users List'
Subject: RE: clustering help



I have two jsp's for the same app on ebot servers(the code that sets and
retrieves the session is below). When i hit the jsp on the first server a
session is created and the id returned. Now i pass this as a parameter to
the second jsp and it retrieves the session associated with this id from the
second server and i can set the attribute value.


server 1:
<%

session.setAttribute("killer", "ant");
out.println("The session id generated is "+session.getId());

%>



server 2:
<%
String id = request.getParameter("id");
HttpSession _session =
request.getSession().getSessionContext().getSession(id);
if(_session == null){
        out.println("session not available id: "+id);
        return;
}
String test = (String) _session.getValue("killer");
out.println("The killer value of session with ID "+ id +" is "+test);
%>





Regards,
Nandish Rudra



-----Original Message-----
From: Filip Hanik - Dev [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 02, 2004 5:23 PM
To: Tomcat Users List
Subject: Re: clustering help


the logs are showing that everything is replicating fine.
you can't change the browser url when switching to the other server, 
how are you testing if it works or not?
Filip
----- Original Message ----- 
From: "Dale, Matt" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Thursday, December 02, 2004 4:10 PM
Subject: RE: clustering help


do you have the <distributable/> tag in your applications web.xml?

-----Original Message-----
From: Nandish Rudra [mailto:[EMAIL PROTECTED]
Sent: 02 December 2004 22:08
To: Tomcat Users List (E-mail)
Subject: clustering help


Hello,

I an running tomcat 5.0.28 on redhat 9 and having some clustering problem.
Here are the clusternig part of server.xml and the logs. The server.xml on
both machines have the same cluster element values (see below). The
application is with all jsp's.

Sessions are created but not replicated across the machines. Can anyone
please help me with this?

server.xml:
<Cluster
className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
 
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
                 expireSessionsOnShutdown="false"
                 useDirtyFlag="true"
printToScreen="true">

            <Membership 
                className="org.apache.catalina.cluster.mcast.McastService"
name="webres-qa-cluster"
                mcastAddr="228.0.0.4"
                mcastPort="45565"
                mcastFrequency="500"
                mcastDropTime="3000"
printToScreen="true"
debug="10"/>

            <Receiver 
 
className="org.apache.catalina.cluster.tcp.ReplicationListener"
                tcpListenAddress="auto"
                tcpListenPort="4002"
                tcpSelectorTimeout="100"
                tcpThreadCount="6"
  printToScreen="true"/>

            <Sender
 
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
                replicationMode="synchronous"/>

            <Valve
className="org.apache.catalina.cluster.tcp.ReplicationValve"
 
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
        <!--       
            <Deployer
className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
                      tempDir="/tmp/war-temp/"
                      deployDir="/tmp/war-deploy/"
                      watchDir="/tmp/war-listen/"
                      watchEnabled="true"/>
      -->
        </Cluster>


logs:
Dec 2, 2004 4:54:50 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Dec 2, 2004 4:54:50 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2378 ms
Dec 2, 2004 4:54:51 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Dec 2, 2004 4:54:51 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.0.28
Dec 2, 2004 4:54:51 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Dec 2, 2004 4:54:51 PM org.apache.catalina.cluster.tcp.SimpleTcpCluster
start
INFO: Cluster is about to start
Dec 2, 2004 4:54:51 PM org.apache.catalina.cluster.mcast.McastService start
INFO: Sleeping for 2000 secs to establish cluster membership
Dec 2, 2004 4:54:51 PM org.apache.catalina.cluster.tcp.SimpleTcpCluster
memberAdded
INFO: Replication member
added:org.apache.catalina.cluster.mcast.McastMember[tcp://192.168.1.104:4002
,192.168.1.104,4002, alive=27652]
Dec 2, 2004 4:54:53 PM org.apache.catalina.core.StandardHost getDeployer
INFO: Create Host deployer for direct deployment ( non-jmx ) 
Dec 2, 2004 4:54:53 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL
file:/usr/local/jakarta-tomcat-5.0.28/conf/Catalina/localhost/admin.xml
Dec 2, 2004 4:54:54 PM org.apache.struts.util.PropertyMessageResources
<init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
Dec 2, 2004 4:54:54 PM org.apache.struts.util.PropertyMessageResources
<init>
INFO: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
Dec 2, 2004 4:54:55 PM org.apache.struts.util.PropertyMessageResources
<init>
INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources',
returnNull=true
Dec 2, 2004 4:54:57 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL
file:/usr/local/jakarta-tomcat-5.0.28/conf/Catalina/localhost/balancer.xml
Dec 2, 2004 4:54:57 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL
file:/usr/local/jakarta-tomcat-5.0.28/conf/Catalina/localhost/manager.xml
Dec 2, 2004 4:54:58 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path  from URL
file:/usr/local/jakarta-tomcat/webapps/ROOT




Creating ClusterManager for context  using class
org.apache.catalina.cluster.session.DeltaManager (Root Context)




Dec 2, 2004 4:54:58 PM org.apache.catalina.cluster.session.DeltaManager
start
INFO: Starting clustering manager...:
Dec 2, 2004 4:54:58 PM org.apache.catalina.cluster.session.DeltaManager
start
WARNING: Manager[], requesting session state from
org.apache.catalina.cluster.mcast.McastMember[tcp://192.168.1.104:4002,192.1
68.1.104,4002, alive=34282]. This operation will timeout if no session state
has been received within 60 seconds
Dec 2, 2004 4:54:58 PM org.apache.catalina.cluster.session.DeltaManager
start
INFO: Manager[], session state received in 110 ms.
Dec 2, 2004 4:54:58 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /jsp-examples from URL
file:/usr/local/jakarta-tomcat-5.0.28/webapps/jsp-examples
Dec 2, 2004 4:54:58 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /servlets-examples from URL
file:/usr/local/jakarta-tomcat-5.0.28/webapps/servlets-examples
Dec 2, 2004 4:54:58 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /tomcat-docs from URL
file:/usr/local/jakarta-tomcat-5.0.28/webapps/tomcat-docs
Dec 2, 2004 4:54:59 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /webdav from URL
file:/usr/local/jakarta-tomcat-5.0.28/webapps/webdav
Dec 2, 2004 4:54:59 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /ROOT.ORIG from URL
file:/usr/local/jakarta-tomcat-5.0.28/webapps/ROOT.ORIG
Dec 2, 2004 4:54:59 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Dec 2, 2004 4:54:59 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
Dec 2, 2004 4:54:59 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=1/260
config=/usr/local/jakarta-tomcat/conf/jk2.properties
Dec 2, 2004 4:54:59 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8899 ms
Dec 2, 2004 4:59:09 PM
org.apache.catalina.cluster.tcp.ReplicationTransmitter addStats
INFO: Nr of bytes sent=43516 over 100 ==435 bytes/request
Dec 2, 2004 5:03:27 PM
org.apache.catalina.cluster.tcp.ReplicationTransmitter addStats
INFO: Nr of bytes sent=87184 over 200 ==435 bytes/request
Dec 2, 2004 5:03:27 PM org.apache.catalina.cluster.tcp.ReplicationValve
addClusterSendTime
INFO: Average request time=70 ms for Cluster overhead time=7 ms for 100
requests (Request=7079ms Cluster=702ms).


Regards,
Nandish Rudra
ECI Conference Call Services, LLC



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




----------------------------------------------------------------------------
----


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Any opinions expressed in this E-mail may be those of the individual and not 
necessarily the company. This E-mail and any files transmitted with it are 
confidential and solely for the use of the intended recipient. If you are not 
the intended recipient or the person responsible for delivering to the intended 
recipient, be advised that you have received this E-mail in error and that any 
use or copying is strictly prohibited. If you have received this E-mail in 
error please notify the beCogent postmaster at [EMAIL PROTECTED]
Unless expressly stated, opinions in this email are those of the individual 
sender and not beCogent Ltd. You must take full responsibility for virus 
checking this email and any attachments.
Please note that the content of this email or any of its attachments may 
contain data that falls within the scope of the Data Protection Acts and that 
you must ensure that any handling or processing of such data by you is fully 
compliant with the terms and provisions of the Data Protection Act 1984 and 
1998.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to