Hi,

/Tomcat 7.0.10, OSX 10.6.5, jk 1.2.31, and httpd 2.2.17/

 Without any explicit parameters in server.xml, just by setting the jvmRoute 
attribute in the Engine element and enabling Clustering, session failover 
worked if I shut down one or the other tomcat instance or the one httpd that 
was not the reverse proxy.  

However when I just stopped the example webapp in one tomcat, the session did 
not failover and I received a 404 http error instead of the expected session 
page from the other tomcat.

Based upon the instructions found in the book:  
http://proquest.safaribooksonline.com/9780596101060/tomcat_6_clustering_implementation?sessionid=&reader=html&imagepage=

explicitely:

<nyissz>
You'll also need to add distributed="true" to the webapp's <Context> element. 
If there is no <Context> element declared for it anywhere, you will need to 
create one. You can create one by making a 
newCATALINA_HOME/conf/[EngineName]/[HostName]/examples.xml context XML fragment 
file or by adding one to server.xml.
<nyassz>

my thought was that the ReplicatedContect was not initiated.  Well, I already 
learned that I should not add any context into server.xml and there is nothing 
in the

bml0066:local administrator$ ls -l tomcat1/conf/Catalina/localhost/
bml0066:local administrator$ 

directory,  so I created a META-INF directory inside the examples directory and 
placed a context.xml there with the following content:

bml0066:local administrator$ cat tomcat1/webapps/examples/META-INF/context.xml 
<?xml version="1.0" encoding="UTF-8"?>
<Context className="org.apache.catalina.ha.context.ReplicatedContext" 
distributed="true" >
</Context>

I did it on both tomcats and bounced them.  Now when I look the log, I see the 
following warning just after restart:

INFO: Deploying web application directory examples
Apr 11, 2011 12:00:28 PM org.apache.catalina.startup.SetContextPropertiesRule 
begin
WARNING: [SetContextPropertiesRule]{Context} Setting property 'distributed' to 
'true' did not find a matching property.
Apr 11, 2011 12:00:28 PM org.apache.catalina.tribes.tipis.AbstractReplicatedMap 
init
INFO: Initializing AbstractReplicatedMap with context name:/examples
Apr 11, 2011 12:00:28 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Apr 11, 2011 12:00:28 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()


So the first question is, should I use the distributed="true" property here ?  
Is the book right ?  I think it is from 2007.  I already have the 
<distributable/> tag in the webapp's web.xml.

The second question is what to do to avoid the 404 message and fail the session 
over instead of it, when I just stop the webapp on the tomcat instance?  By 
default I am using sticky sessions.

<nyissz>
bml0066:local administrator$ cat apache2/conf/workers.properties 
worker.list = lb,jkstatus

worker.lb.type=lb
worker.lb.balance_workers=tomcat1,tomcat3
#,tomcat2,tomcat4
worker.lb.sticky_session = True
worker.lb.sticky_session_force = False

worker.jkstatus.type=status

worker.tomcat1.type = ajp13
worker.tomcat1.host = bml0066.yalepath.org
worker.tomcat1.port = 8109
worker.tomcat1.lbfactor = 1
worker.tomcat1.redirect=tomcat3

#worker.tomcat2.type = ajp13
#worker.tomcat2.host = bml0066.yalepath.org
#worker.tomcat2.port = 8209
#worker.tomcat2.lbfactor = 1
#worker.tomcat2.redirect=tomcat4

worker.tomcat3.type = ajp13
worker.tomcat3.host = bml0065.yalepath.org
worker.tomcat3.port = 8309
worker.tomcat3.lbfactor = 1
worker.tomcat3.redirect=tomcat1

#worker.tomcat4.type = ajp13
#worker.tomcat4.host = bml0065.yalepath.org
#worker.tomcat4.port = 8409
#worker.tomcat4.lbfactor = 1
#worker.tomcat4.redirect=tomcat2

<nyassz>

Thanks ahead,

János



Reply via email to