You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Scott Danforth <sd...@epathlearning.com> on 2007/02/23 15:56:47 UTC

mod_jk sticky session still not working

Mladen Turk wrote:

> Scott Danforth wrote:
>
>> I'm trying to use jk1.2.20 mod_jk with Apache 1.3 for load balancing 
>> two tomcat services and sticky sessions aren't working.
>
>
> You don't have session affinity mark
> For each instance add jvmRoute="tomcat1" or
> jvmRoute="tomcat2 for a second instance. See:
> http://tomcat.apache.org/tomcat-5.5-doc/config/engine.html


Thanks for your help. That sounds very reasonable, and I modifed the two 
server.xml Engine elements as suggested, but it appears to make no 
difference.

Below are 3 segments from mod_jk.log.

The first segment shows the initial request coming in without a 
sessionid. The request is routed to tomcat1 with route=tomcat1.

The second segment shows the response coming back from tomcat1, with a 
new session id.

The third segment shows the second request coming in with the expected 
session id, and shows tomcat2 being selected with route=tomcat2.

You say I don't have session affinity mark. How would that show up in 
the log? Is the "partial sessionid" an indication of the problem?

    -- Scott.


[Fri Feb 23 09:08:53 2007] [6000:0000] [debug] 
map_uri_to_worker::jk_uri_worker_map.c (575): Attempting to map URI 
'/servlets/Build' from 1 maps
[Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
map_uri_to_worker::jk_uri_worker_map.c (587): Attempting to map context 
URI '/servlets/*=loadbalancer' source 'JkMount'
[Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
map_uri_to_worker::jk_uri_worker_map.c (602): Found a wildchar match 
'/servlets/*=loadbalancer'
[Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
wc_get_worker_for_name::jk_worker.c (114): found a worker loadbalancer
[Fri Feb 23 09:34:59 2007] [6266:0000] [debug] wc_maintain::jk_worker.c 
(321): Maintaining worker loadbalancer
[Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
wc_get_name_for_type::jk_worker.c (290): Found worker type 'lb'
[Fri Feb 23 09:34:59 2007] [6266:0000] [debug] init_ws_service::mod_jk.c 
(561): Service protocol=HTTP/1.1 method=GET host=(null) 
addr=192.168.1.50 name=build port=8008 auth=(null) user=(null) 
laddr=192.168.1.7 raddr=192.168.1.50
[Fri Feb 23 09:34:59 2007] [6266:0000] [debug] service::jk_lb_worker.c 
(840): service sticky_session=1 id='empty'
[Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
get_most_suitable_worker::jk_lb_worker.c (785): found best worker 
tomcat1 (tomcat1) using method 'Request'
[Fri Feb 23 09:34:59 2007] [6266:0000] [debug] service::jk_lb_worker.c 
(860): service worker=tomcat1 route=tomcat1

...

[Fri Feb 23 09:35:00 2007] [6266:0000] [debug] 
ajp_unmarshal_response::jk_ajp_common.c (603): status = 200
[Fri Feb 23 09:35:00 2007] [6266:0000] [debug] 
ajp_unmarshal_response::jk_ajp_common.c (610): Number of headers is = 2
[Fri Feb 23 09:35:00 2007] [6266:0000] [debug] 
ajp_unmarshal_response::jk_ajp_common.c (666): Header[0] [Set-Cookie] = 
[JSESSIONID=9E36E3DC58A09ED9045B25F839E37A2C; Path=/]
[Fri Feb 23 09:35:00 2007] [6266:0000] [debug] 
ajp_unmarshal_response::jk_ajp_common.c (666): Header[1] [Content-Type] 
= [text/html;charset=ISO-8859-1]
[Fri Feb 23 09:35:00 2007] [6266:0000] [debug] 
ajp_connection_tcp_get_message::jk_ajp_common.c (1029): received from 
ajp13 pos=0 len=2309 max=8192

...

[Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
map_uri_to_worker::jk_uri_worker_map.c (575): Attempting to map URI 
'/servlets/Build' from 1 maps
[Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
map_uri_to_worker::jk_uri_worker_map.c (587): Attempting to map context 
URI '/servlets/*=loadbalancer' source 'JkMount'
[Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
map_uri_to_worker::jk_uri_worker_map.c (602): Found a wildchar match 
'/servlets/*=loadbalancer'
[Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
wc_get_worker_for_name::jk_worker.c (114): found a worker loadbalancer
[Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
wc_get_name_for_type::jk_worker.c (290): Found worker type 'lb'
[Fri Feb 23 09:35:10 2007] [6266:0000] [debug] init_ws_service::mod_jk.c 
(561): Service protocol=HTTP/1.1 method=POST host=(null) 
addr=192.168.1.50 name=build port=8008 auth=(null) user=(null) 
laddr=192.168.1.7 raddr=192.168.1.50
[Fri Feb 23 09:35:10 2007] [6266:0000] [debug] service::jk_lb_worker.c 
(840): service sticky_session=1 id='9E36E3DC58A09ED9045B25F839E37A2C'
[Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
get_most_suitable_worker::jk_lb_worker.c (733): searching worker for 
partial sessionid 9E36E3DC58A09ED9045B25F839E37A2C
[Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
get_most_suitable_worker::jk_lb_worker.c (785): found best worker 
tomcat2 (tomcat2) using method 'Request'
[Fri Feb 23 09:35:10 2007] [6266:0000] [debug] service::jk_lb_worker.c 
(860): service worker=tomcat2 route=tomcat2



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mod_jk sticky session still not working

Posted by Scott Danforth <sd...@epathlearning.com>.
P.S. I see a mention of "cluster" in the documentation for jvmRoute. Do 
I need to configure a "cluster" perhaps?

    -- Scott.


Scott Danforth wrote:

> Mladen Turk wrote:
>
>> Scott Danforth wrote:
>>
>>> I'm trying to use jk1.2.20 mod_jk with Apache 1.3 for load balancing 
>>> two tomcat services and sticky sessions aren't working.
>>
>>
>>
>> You don't have session affinity mark
>> For each instance add jvmRoute="tomcat1" or
>> jvmRoute="tomcat2 for a second instance. See:
>> http://tomcat.apache.org/tomcat-5.5-doc/config/engine.html
>
>
>
> Thanks for your help. That sounds very reasonable, and I modifed the 
> two server.xml Engine elements as suggested, but it appears to make no 
> difference.
>
> Below are 3 segments from mod_jk.log.
>
> The first segment shows the initial request coming in without a 
> sessionid. The request is routed to tomcat1 with route=tomcat1.
>
> The second segment shows the response coming back from tomcat1, with a 
> new session id.
>
> The third segment shows the second request coming in with the expected 
> session id, and shows tomcat2 being selected with route=tomcat2.
>
> You say I don't have session affinity mark. How would that show up in 
> the log? Is the "partial sessionid" an indication of the problem?
>
>    -- Scott.
>
>
> [Fri Feb 23 09:08:53 2007] [6000:0000] [debug] 
> map_uri_to_worker::jk_uri_worker_map.c (575): Attempting to map URI 
> '/servlets/Build' from 1 maps
> [Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
> map_uri_to_worker::jk_uri_worker_map.c (587): Attempting to map 
> context URI '/servlets/*=loadbalancer' source 'JkMount'
> [Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
> map_uri_to_worker::jk_uri_worker_map.c (602): Found a wildchar match 
> '/servlets/*=loadbalancer'
> [Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
> wc_get_worker_for_name::jk_worker.c (114): found a worker loadbalancer
> [Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
> wc_maintain::jk_worker.c (321): Maintaining worker loadbalancer
> [Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
> wc_get_name_for_type::jk_worker.c (290): Found worker type 'lb'
> [Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
> init_ws_service::mod_jk.c (561): Service protocol=HTTP/1.1 method=GET 
> host=(null) addr=192.168.1.50 name=build port=8008 auth=(null) 
> user=(null) laddr=192.168.1.7 raddr=192.168.1.50
> [Fri Feb 23 09:34:59 2007] [6266:0000] [debug] service::jk_lb_worker.c 
> (840): service sticky_session=1 id='empty'
> [Fri Feb 23 09:34:59 2007] [6266:0000] [debug] 
> get_most_suitable_worker::jk_lb_worker.c (785): found best worker 
> tomcat1 (tomcat1) using method 'Request'
> [Fri Feb 23 09:34:59 2007] [6266:0000] [debug] service::jk_lb_worker.c 
> (860): service worker=tomcat1 route=tomcat1
>
> ...
>
> [Fri Feb 23 09:35:00 2007] [6266:0000] [debug] 
> ajp_unmarshal_response::jk_ajp_common.c (603): status = 200
> [Fri Feb 23 09:35:00 2007] [6266:0000] [debug] 
> ajp_unmarshal_response::jk_ajp_common.c (610): Number of headers is = 2
> [Fri Feb 23 09:35:00 2007] [6266:0000] [debug] 
> ajp_unmarshal_response::jk_ajp_common.c (666): Header[0] [Set-Cookie] 
> = [JSESSIONID=9E36E3DC58A09ED9045B25F839E37A2C; Path=/]
> [Fri Feb 23 09:35:00 2007] [6266:0000] [debug] 
> ajp_unmarshal_response::jk_ajp_common.c (666): Header[1] 
> [Content-Type] = [text/html;charset=ISO-8859-1]
> [Fri Feb 23 09:35:00 2007] [6266:0000] [debug] 
> ajp_connection_tcp_get_message::jk_ajp_common.c (1029): received from 
> ajp13 pos=0 len=2309 max=8192
>
> ...
>
> [Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
> map_uri_to_worker::jk_uri_worker_map.c (575): Attempting to map URI 
> '/servlets/Build' from 1 maps
> [Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
> map_uri_to_worker::jk_uri_worker_map.c (587): Attempting to map 
> context URI '/servlets/*=loadbalancer' source 'JkMount'
> [Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
> map_uri_to_worker::jk_uri_worker_map.c (602): Found a wildchar match 
> '/servlets/*=loadbalancer'
> [Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
> wc_get_worker_for_name::jk_worker.c (114): found a worker loadbalancer
> [Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
> wc_get_name_for_type::jk_worker.c (290): Found worker type 'lb'
> [Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
> init_ws_service::mod_jk.c (561): Service protocol=HTTP/1.1 method=POST 
> host=(null) addr=192.168.1.50 name=build port=8008 auth=(null) 
> user=(null) laddr=192.168.1.7 raddr=192.168.1.50
> [Fri Feb 23 09:35:10 2007] [6266:0000] [debug] service::jk_lb_worker.c 
> (840): service sticky_session=1 id='9E36E3DC58A09ED9045B25F839E37A2C'
> [Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
> get_most_suitable_worker::jk_lb_worker.c (733): searching worker for 
> partial sessionid 9E36E3DC58A09ED9045B25F839E37A2C
> [Fri Feb 23 09:35:10 2007] [6266:0000] [debug] 
> get_most_suitable_worker::jk_lb_worker.c (785): found best worker 
> tomcat2 (tomcat2) using method 'Request'
> [Fri Feb 23 09:35:10 2007] [6266:0000] [debug] service::jk_lb_worker.c 
> (860): service worker=tomcat2 route=tomcat2
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>

-- 

Scott Danforth, Ph.D.
Director of Technology
ePath Learning, Inc.
70 Howard Street, Suite C
New London, CT 06320
Phone: (860) 444-6989 ext. 3
Fax: (215) 243-7454
email: sdanforth@ePathLearning.com




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [OT] mod_jk sticky session now working !! My bad.

Posted by Babu Satasiya <ba...@gmail.com>.
Hi Scott,

Good its now working for you, I hope you can share your server.xml and
workers.properties for community, so others can benefits of it. 

I would like to know do you use cluster or not? If yes, you tried stopping
one of tomcat and your session is still continued or not? 

With cluster one can do session replication and it will help to have high
availabilty and load balancing together.

Please update.

Babu Satasiya

Cisco System Inc.

Scott Danforth wrote:
> 
> Aha!!!
> 
> I was confused by the XML. I was changing the Engine element that was 
> previously commented out, and this, of course, is followed by another 
> (the real one, which wins, and didn't have a jvmRoute).
> 
> Thanks so much! Your comments helped me find my problem.
> 
>     Thanks,
>     -- Scott.
> 
> 
> Scott Danforth wrote:
> 
>> Hi Mladen,
>>
>> I really appreciate your help, and am happy that you're seeing a 
>> problem in the log output.
>>
>> I think I've got the Engine attributes specified correctly, and the 
>> two different jvmRoute values do show up in the mod_jk log.
>>
>> <Engine name="Standalone" defaultHost="localhost" debug="0" 
>> jvmRoute="tomcat1" />
>> <Engine name="Standalone" defaultHost="localhost" debug="0" 
>> jvmRoute="tomcat2" />  
>> Maybe if I give the Engines different names? It sounds like we're 
>> expecting the jvmRoute to be appended to the sessionId that is 
>> returned in the Set-Cookie header? If so, I guess mod_jk is working as 
>> expected, and I'm just not getting the right sessionid created by Tomcat.
>>
>> I'm not using Boss. Just Apache and Tomcat on a single Solaris machine.
>>
>>    -- Scott.
>>
>>
>> Mladen Turk wrote:
>>
>>> Scott Danforth wrote:
>>>
>>>> Mladen Turk wrote:
>>>>
>>>>
>>>> Thanks for your help. That sounds very reasonable, and I modifed the 
>>>> two server.xml Engine elements as suggested, but it appears to make 
>>>> no difference.
>>>>
>>>> get_most_suitable_worker::jk_lb_worker.c (733): searching worker for 
>>>> partial sessionid 9E36E3DC58A09ED9045B25F839E37A2C
>>>
>>>
>>>
>>> You still don't have jvmRoute appended.
>>> Check if jvmRoute (param name is case sensitive!) is
>>> correctly set up.
>>> Also, if you use JBoss add <attribute name="UseJK">true</attribute>
>>> see:
>>> http://www.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss
>>>
>>>
>>> Regards,
>>> Mladen.
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/mod_jk-sticky-session-not-working---tf3276314.html#a9192294
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


mod_jk sticky session now working !! My bad.

Posted by Scott Danforth <sd...@epathlearning.com>.
Aha!!!

I was confused by the XML. I was changing the Engine element that was 
previously commented out, and this, of course, is followed by another 
(the real one, which wins, and didn't have a jvmRoute).

Thanks so much! Your comments helped me find my problem.

    Thanks,
    -- Scott.


Scott Danforth wrote:

> Hi Mladen,
>
> I really appreciate your help, and am happy that you're seeing a 
> problem in the log output.
>
> I think I've got the Engine attributes specified correctly, and the 
> two different jvmRoute values do show up in the mod_jk log.
>
> <Engine name="Standalone" defaultHost="localhost" debug="0" 
> jvmRoute="tomcat1" />
> <Engine name="Standalone" defaultHost="localhost" debug="0" 
> jvmRoute="tomcat2" />  
> Maybe if I give the Engines different names? It sounds like we're 
> expecting the jvmRoute to be appended to the sessionId that is 
> returned in the Set-Cookie header? If so, I guess mod_jk is working as 
> expected, and I'm just not getting the right sessionid created by Tomcat.
>
> I'm not using Boss. Just Apache and Tomcat on a single Solaris machine.
>
>    -- Scott.
>
>
> Mladen Turk wrote:
>
>> Scott Danforth wrote:
>>
>>> Mladen Turk wrote:
>>>
>>>
>>> Thanks for your help. That sounds very reasonable, and I modifed the 
>>> two server.xml Engine elements as suggested, but it appears to make 
>>> no difference.
>>>
>>> get_most_suitable_worker::jk_lb_worker.c (733): searching worker for 
>>> partial sessionid 9E36E3DC58A09ED9045B25F839E37A2C
>>
>>
>>
>> You still don't have jvmRoute appended.
>> Check if jvmRoute (param name is case sensitive!) is
>> correctly set up.
>> Also, if you use JBoss add <attribute name="UseJK">true</attribute>
>> see:
>> http://www.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss
>>
>>
>> Regards,
>> Mladen.
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mod_jk sticky session still not working

Posted by Scott Danforth <sd...@epathlearning.com>.
Hi Mladen,

I really appreciate your help, and am happy that you're seeing a problem 
in the log output.

I think I've got the Engine attributes specified correctly, and the two 
different jvmRoute values do show up in the mod_jk log.

<Engine name="Standalone" defaultHost="localhost" debug="0" 
jvmRoute="tomcat1" />
<Engine name="Standalone" defaultHost="localhost" debug="0" 
jvmRoute="tomcat2" />   

Maybe if I give the Engines different names? It sounds like we're 
expecting the jvmRoute to be appended to the sessionId that is returned 
in the Set-Cookie header? If so, I guess mod_jk is working as expected, 
and I'm just not getting the right sessionid created by Tomcat.

I'm not using Boss. Just Apache and Tomcat on a single Solaris machine.

    -- Scott.


Mladen Turk wrote:

> Scott Danforth wrote:
>
>> Mladen Turk wrote:
>>
>>
>> Thanks for your help. That sounds very reasonable, and I modifed the 
>> two server.xml Engine elements as suggested, but it appears to make 
>> no difference.
>>
>> get_most_suitable_worker::jk_lb_worker.c (733): searching worker for 
>> partial sessionid 9E36E3DC58A09ED9045B25F839E37A2C
>
>
> You still don't have jvmRoute appended.
> Check if jvmRoute (param name is case sensitive!) is
> correctly set up.
> Also, if you use JBoss add <attribute name="UseJK">true</attribute>
> see:
> http://www.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss
>
>
> Regards,
> Mladen.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>

-- 

Scott Danforth, Ph.D.
Director of Technology
ePath Learning, Inc.
70 Howard Street, Suite C
New London, CT 06320
Phone: (860) 444-6989 ext. 3
Fax: (215) 243-7454
email: sdanforth@ePathLearning.com




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mod_jk sticky session still not working

Posted by Mladen Turk <ml...@gmail.com>.
Scott Danforth wrote:
> Mladen Turk wrote:
> 
> 
> Thanks for your help. That sounds very reasonable, and I modifed the two 
> server.xml Engine elements as suggested, but it appears to make no 
> difference.
> 
> get_most_suitable_worker::jk_lb_worker.c (733): searching worker for 
> partial sessionid 9E36E3DC58A09ED9045B25F839E37A2C

You still don't have jvmRoute appended.
Check if jvmRoute (param name is case sensitive!) is
correctly set up.
Also, if you use JBoss add <attribute name="UseJK">true</attribute>
see:
http://www.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss


Regards,
Mladen.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org