> The problem is that I have the same behaviour when I simply 
> reload my page in
> the same Browser instance, jumping from one Tomcat instance 
> to the other as if
> no javax.servlet.http.HttpSession was defined (jsessionid).

I haven't used JK2, but I know how this works with JK(1) and I think it's more or less 
the same thing.  

Some configuration has to be done in JK2, and other configuration has to be done in 
the tomcat instances that are being balanced.

The way that sticky sessions work is that the JSESSIONID cookie value provided by 
Tomcat includes an indicator of which Tomcat instance set the cookie.  The JK (or JK2) 
connector looks at this indicator to decide which instance should handle new requests. 
 That's pretty simple, right?

In JK2, according to the documentation, there is a "tomcatId" attribute for 
channel.socket configuration stanzas.  This attribute is automatically set to the 
local name part of the channel.socket name.  So suppose you have a socket channel 
going to a tomcat instance on host flubber.foo.com, port 8080.  You name the channel:

channel.socket:flubber.foo.com:8080

And the tomcatId gets set to flubber.foo.com:8080 unless you change that explicitly.  
This is the JK2 part of the sticky session configuration.

Now you go to the server.xml configuration file for the tomcat running on 
flubber.foo.com, port 8080.  In the Engine element, you set the attribute jvmRoute to 
"flubber.foo.com:8080".  When that Tomcat instance sets a JSESSIONID cookie, the value 
will be something like:

0928DE35C1F410D99ABDD4E7A6FA65F6.flubber.foo.com:8080

Now when the next request comes in from that browser this JSESSIONID cookie value will 
be sent in the request.  JK2 will look at the flubber.foo.com:8080 part of the value, 
realize that it needs to send the request through that channel, and voila, server 
affinity just like magic!

Does that make sense?

It might help other people with the same problem if you report back whether this works 
or not.  Like I said, I haven't used JK2 so I don't know for sure.


Cheers,

bn

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

Reply via email to