I have a cluster of two JBoss 4.0.1RC1 servers sitting behind an Apache 2 server running mod_jk2. The Apache server is doing load balancing and failover, but so far I have been completely unable to get session stickiness to work. The JSESSIONID cookie never includes the jvmRoute value.
I've modified my jbossweb-tomcat50.sar/server.xml file's Engine tag:
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="sgrimm1">
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="sgrimm2">
My application's web.xml has the "distributable" tag.
The two hosts see each other in the cluster; I get log messages at startup like
14:37:20,056 INFO [DefaultPartition] New cluster view for partition DefaultPartition: 9 ([10.0.0.1:1099, 10.0.0.2:1099] delta: 0) 14:37:20,067 INFO [DefaultPartition] I am (null) received membershipChanged event: 14:37:20,071 INFO [DefaultPartition] Dead members: 0 () 14:37:20,076 INFO [DefaultPartition] New Members : 0 () 14:37:20,080 INFO [DefaultPartition] All Members : 2 ([10.0.0.1:1099, 10.0.0.2:1099])
I tried running a network sniffer on the traffic between Apache and JBoss, and I see that JBoss is sending back a JSESSIONID cookie that doesn't include the jvmRoute value. So I assume it's not a problem with the configuration on the Apache side. Or is mod_jk2 supposed to be the thing that appends the jvmRoute to the session cookie? Here's my workers2.properties just in case it's relevant.
[shm] file=/tmp/mod_jk2_shm.file size=1048576 [channel.socket:sgrimm1:8009] [channel.socket:sgrimm2:8009] [ajp13:sgrimm1:8009] channel=channel.socket:sgrimm1:8009 tomcatId=sgrimm1 [ajp13:sgrimm2:8009] channel=channel.socket:sgrimm2:8009 tomcatId=sgrimm2 [status:status] [lb:lb] stickySession=1 [uri:/jsp/*] worker=lb [uri:/jmx-console/*] worker=lb
I originally had "[lb]" instead of "[lb:lb]" but it made no difference.
In attempting to diagnose the problem, I tried adding a debug logger to the Tomcat server.xml, using the existing logger as a guide:
<Logger className="org.jboss.web.tomcat.Log4jLogger" verbosityLevel="DEBUG" category="org.jboss.web"/>
I don't get any debug output, but I do get this message:
13:35:30,262 INFO [STDOUT] Can't find resource org.jboss.web.tomcat.session.LocalStrings org.jboss.web.tomcat.tc5.WebCtxLoader$ENCLoader@f3387 13:35:30,265 INFO [STDOUT] [Ljava.net.URL;@1e16028
(It looks like there is a LocalStrings.properties in org.jboss.web.tomcat.tc5.session, but not in org.jboss.web.tomcat.session.)
Any thoughts on how I can diagnose this, or better yet, fix it?