It looks to me as if the '.'s in your worker names are confusing mod_jk which is using '.' as the divider between the session id and it's tracking information.
you have:
2bsrdkc35sesq.192.168.1.152:8009
pick some simpler worker names like w1,w2,w3, instead of <i/p>:port and report back,
2bsrdkc35sesq.w1 - would be more likely to work...
good luck,
Jules
Surajit Bhattacharjee wrote:
Hi Jules,
Thanks a lot for trying to help me out!
I have gone thru the steps you have mentioned. My findings are summarised below:
1. My web app is a simple servlet that creates a new HTTP session if the request is not already associated with one. Additionally, it prints out the cookies that accompany the HTTP request. I have verified that the servlet does create a session with an id that looks like <string-id>.xxx where xxx = the worker name. An example id: 2bsrdkc35sesq.192.168.1.152:8009
2. The JSESSIONID cookie comes down to the browser with value = the session id. Browser (IE 5 and 6) is configured to accept cookies.
3. Now, for the next request, the browser sends the cookie to Apache, and finally it reaches my servlet, but this time, on the OTHER Jetty instance. This results in the servlet not finding an HTTP session for the request, and in turn creating a fresh session (whose id now goes as the cookie value to the client, and lands on the other Jetty instance when the next request is made). This alternating between the 2 Jetty instances keeps happening for all subsequent requests, and each time a new session gets created on Jetty.
4. When I switch off one of the Jetty instances (leaving Apache with only 1 Jetty to work with), the session sticks fine, thus demonstrating that basic HTTP session tracking is working end to end without any issues.
5. Looks like the web app (servlet), Jetty, and Browser are all doing their job fine. I am inclined to point fingers at MOD_JK2 now - maybe that is the component that is not working as expected. It should read the JSESSIONID cookie value, and realize that this is a 'pinned' session, and it only needs to forward it to that specific Jetty instance instead of giving it the 'round robin' treatment intended for new requests.
6. I don't see anything bad in the error/access logs of Apache and mod_jk2.
7. I am using mod_jk2-2.0.43.so downloaded from the Apache site. I have not built it locally. Should I ? If so, is there particular mode I need to build it for (like worker MPM or something) ?
8. Do you think you can mail me the mod_jk2 dll (so) that you have used. (If it was on Solaris by any chance).
Thanks in advance for all your help!
Best regards, Surajit
-----Original Message----- From: Jules Gosnell [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2003 9:35 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [JBoss-user] MOD_JK2 PROBLEM - SETTING UP STICKY SESSIONS
Surajit,
point your browser at the correct context on your apache..
is the connection refused - apache problem
if you get a page back:
is it:
an apache error page - mod_jk config problem
a jetty error page - problem with jetty/webapp webapp
the expected response.
if it is the expected response, have you been redirected to a new url with a jsessionid param, or does your cookie manager show a new JSESSIONID cookie ?
If not, your servlet/webapp has not allocated you a session.
If so, is the session suffixed with a '.xxx' where xxx is the worker name from your mod_jk2.conf ?
if not, you have a problem with Jetty (perhaps an early version?) which should find the worker name in the AJP request.
if so, make another request to the same context from your browser.
if the request does not go to the same Jetty, either the browser is not passing the cookie in the request, or the session is may have been erased from your url (you need to properly encode the url).
if the request does go to the same Jetty - you now have a sticky session.
Please walk through this and let me know where something goes wrong. I will drill down with you and sort it out.
Jules
do
Surajit Bhattacharjee wrote:
Hi Vlad!m
I apologise for bothering you like this!
I have tried this with embedded Jetty on JBoss 3.2.0, Apache 2.0.47 (built using worker MPM), mod_jk2 library from apache site (ver 2.0.43), but I am not able to get sticky sessions still!!! The forceDistributable thing in Jetty's XML file is commented out. Also, my servlets are NOT marked as distributable.
This is the contents of workers2.properties file on Apache side: -------------------------------------------------------------------- # Define the communication channel
[channel.socket:192.168.1.152:8009]
[channel.socket:192.168.1.83:8009]
# define the workers [ajp13:192.168.1.152:8009] channel=channel.socket:192.168.1.152:8009
[ajp13:192.168.1.83:8009] channel=channel.socket:192.168.1.83:8009
# Map the Tomcat examples webapp to the Web server uri space [uri:/*] worker1=ajp13:192.168.1.83:8009 lbfactor=1 worker2=ajp13:192.168.1.152:8009 lbfactor=100 worker.list=worker1,worker2
[shm] file=${serverRoot}/logs/shm.file size=1048576 --------------------------------------------------------------------
1. CAN YOU PLEASE SEND ME THE WORKERS2.PROPERTIES FILE THAT YOU USED ? 2. ANY OTHER CONFIG YOU HAVE DONE ? 3. CAN YOU SEND ME THE MOD_JK2 LIBRARY YOU USED ?
Appreciate your help sincerely!
Regards, Surajit
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Vladyslav Kosulin Sent: Saturday, August 09, 2003 1:03 AM To: [EMAIL PROTECTED] Subject: Re: [JBoss-user] MOD_JK2 PROBLEM - SETTING UP STICKY SESSIONS
Surajit, I use Jetty instead of Tomcat, so I don't know if you need some more job done on the Tomcat side.
Hi Vlad!./configure --prefix=/home/surajit/sms/lb/apache/apache/new-build --with-mp
I got the build thru, but I am still not getting stick session behavior. Will I need to do some additional config ?
"httpd -l" does NOT show prefork.c anymore (below is the listing):
home/surajit/sms/lb/apache/apache/new-install/bin>httpd -l Compiled in modules: core.c mod_access.c mod_auth.c mod_include.c mod_log_config.c mod_env.c mod_setenvif.c worker.c http_core.c mod_mime.c mod_status.c mod_autoindex.c mod_asis.c mod_cgid.c mod_negotiation.c mod_dir.c mod_imap.c mod_actions.c mod_userdir.c mod_alias.c mod_so.c /home/surajit/sms/lb/apache/apache/new-install/bin>
Appreciate your help!
Best Regards, Surajit
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Surajit Bhattacharjee Sent: Friday, August 08, 2003 12:57 PM To: [EMAIL PROTECTED] Subject: RE: [JBoss-user] MOD_JK2 PROBLEM - SETTING UP STICKY SESSIONS
Hi Vlad!
I tried to build Apache with 'MPM worker' on Solaris but got an error.
I ran the following to build: 1.
and=worker 2. make 3. make install
Now, the build fails at step 2 with the following messages:
------------------------------------------------------------------ ld: fatal: symbol `ap_mpm_pod_open' is multiply-defined: (file server/mpm/worker/.libs/libworker.al(pod.lo) and file server/.libs/libmain.al(mpm_common.lo)); ld: fatal: symbol `ap_mpm_pod_signal' is multiply-defined: (file server/mpm/worker/.libs/libworker.al(pod.lo) and file server/.libs/libmain.al(mpm_common.lo)); ld: fatal: symbol `ap_mpm_pod_close' is multiply-defined: (file server/mpm/worker/.libs/libworker.al(pod.lo) and file server/.libs/libmain.al(mpm_common.lo)); ld: fatal: symbol `ap_mpm_pod_killpg' is multiply-defined: (file server/mpm/worker/.libs/libworker.al(pod.lo) and file server/.libs/libmain.al(mpm_common.lo)); ld: fatal: symbol `ap_mpm_pod_check' is multiply-defined: (file server/mpm/worker/.libs/libworker.al(pod.lo) and file server/.libs/libmain.al(mpm_common.lo)); ld: fatal: File processing errors. No output written to .libs/httpd collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `httpd' Current working directory /home/surajit/sms/lb/apache/apache/httpd-2.0.43 *** Error code 1 make: Fatal error: Command failed for target `all-recursive' ------------------------------------------------------------------
AM I DOING SOMETHING WRONG HERE ? I also read http://www.mail-archive.com/[EMAIL PROTECTED]/msg97888.html
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01it says the the MPM worker build for Apache 2 does not go thru on Solaris. Is this right ?
Any help will be deeply appreciated!!!
Regards, Surajit
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Surajit Bhattacharjee Sent: Thursday, August 07, 2003 10:38 PM To: [EMAIL PROTECTED] Subject: RE: [JBoss-user] MOD_JK2 PROBLEM - SETTING UP STICKY SESSIONS
Hi Vlad!
Thanks a lot! I did a "httpd -l" and found prefork.c in it. I will rebuild Apache as suggested and try - but before I do that, I just wanted to reiterate that this is mod_jk2 and NOT mod_jk. Would like to confirm with you that rebuilding Apache ALONE will do the trick. Do I need to build MOD_JK2 as well ?
Thanks once again!
Best Regards, Surajit
----------------------------------------------------------------------- I guess you have the prefork MPM enabled in your Apache (this is default MPM for UNIX). It does not work with mod_jk sticky sessions. Please chech that you do not use prefork MPM and use the worker MPM in your Apache installation: httpd -l If you see prefork.c you should build Apache with worker MPM enabled instead of default prefork using configure --with-mpm=worker ...
Vlad
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01_______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01_______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01_______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET.
_______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
-- /********************************** * Jules Gosnell * Partner * Core Developers Network (Europe) **********************************/
-- /********************************** * Jules Gosnell * Partner * Core Developers Network (Europe) **********************************/
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user