Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
mod_jk sticky sessions don 't work

mod_jk sticky sessions don 't work

2007-08-02       - By Claudio Tassini

 Back
Reply:     1     2  

Hi all!
I'm trying to configure mod_jk to handle balance two apache-tomcat instances
through an Apache "reverse proxy", i read all the documentation, reference
guides and howtos i found but it still doesn't work...

Below are some configuration I'm using. The symptoms are that I connect with
a browser to a jsp page that prints out the tomcat server that is managing
the session, and the relative session ID. Every time I refresh the page, the
server name and the sessionID change.

I'm using apache httpd 2.2.4 build from source, mod_jk 1.2.23 and
apache-tomcat 5.5.23 . Now, this is the httpd.conf (relevant parts only):


JkWorkersFile /usr/local/apache2/conf/workers.properties
JkShmFile     /usr/local/apache2/logs/mod_jk.shm
JkLogFile     /usr/local/apache2/logs/mod_jk.log
JkLogLevel    debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
JkRequestLogFormat "%w %V %T"
NameVirtualHost *:80

<VirtualHost *:80>
       ServerName      portal.domain.it
       JkMount /status status
       JkMount /*      test
</VirtualHost>

The workers.properties:

worker.list=test
worker.portal1.port=8009
worker.portal1.host=inca-portal1
worker.portal1.type=ajp13
worker.portal1.lbfactor=1
worker.portal2.port=8009
worker.portal2.host=inca-portal2
worker.portal2.type=ajp13
worker.portal2.lbfactor=1
worker.test.type=lb
worker.test.balance_workers=portal1,portal2
worker.test.sticky_session=True


And, finally, I changed the tomcat server.xml file:
<!-- Define an AJP 1.3 Connector on port 8009 -->
   <Connector port="8009"
              enableLookups="false" redirectPort="8443" protocol="AJP/1.3"
/>
<Engine name="Standalone" defaultHost="localhost" jvmRoute="portal1"
debug="1" />

Finally, this is a piece of the log saying that he founds a certain session
ID, and then he sends the request to the other server which then obviously
sets a new JSESSIONID... :
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
map_uri_to_worker::jk_uri_worker_map.c (589): Attempting to map URI
'/jsp-examples/sesstest.jsp' from 2 maps
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI
'/status=status' source 'JkMount'
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI
'/*=test' source 'JkMount'
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
map_uri_to_worker::jk_uri_worker_map.c (616): Found a wildchar match
'/*=test'
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug] jk_handler::mod_jk.c (2111):
Into handler jakarta-servlet worker=test r->proxyreq=0
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
wc_get_worker_for_name::jk_worker.c (114): found a worker test
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
maintain_workers::jk_lb_worker.c (543): decay with 2^38
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
wc_get_name_for_type::jk_worker.c (290): Found worker type 'lb'
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug] init_ws_service::mod_jk.c
(607): Service protocol=HTTP/1.1 method=GET host=(null) addr=192.168.10.2name=
portal.inca.it port=80 auth=(null) user=(null) laddr=192.168.10.201 raddr=
192.168.10.2
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug] service::jk_lb_worker.c
(915): service sticky_session=1 id='64EEDE6D4E3C9EF3A2048741CDA5C189'
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
get_most_suitable_worker::jk_lb_worker.c (767): searching worker for partial
sessionid 64EEDE6D4E3C9EF3A2048741CDA5C189
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
get_most_suitable_worker::jk_lb_worker.c (819): found best worker portal2
(portal2) using method 'Request'
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug] service::jk_lb_worker.c
(935): service worker=portal2 route=portal2
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
ajp_get_endpoint::jk_ajp_common.c (2343): acquired connection pool slot=0
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
ajp_marshal_into_msgb::jk_ajp_common.c (548): ajp marshaling done
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug] ajp_service::jk_ajp_common.c
(1796): processing portal2 with 2 retries
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug] ws_write::mod_jk.c (452):
written 274 out of 274
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): received from ajp13
pos=0 len=2 max=8192
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0000    05 01 00 00
00 00 00 00 00 00 00 00 00 00 00 00  - ................
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug]
ajp_process_callback::jk_ajp_common.c (1506): AJP13 protocol: Reuse is OK
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug] ajp_done::jk_ajp_common.c
(2286): recycling connection pool slot=0 for worker portal2
[Thu Aug 02 16:52:09 2007] test portal.inca.it 0.005241
[Thu Aug 02 16:52:09 2007] [1970:44448] [debug] jk_handler::mod_jk.c (2238):
Service finished with status=200 for worker=test


Any help would be REALLY appreciated!


Fi

--
Claudio Tassini

©2008 junlu.com - Jax Systems, LLC, U.S.A.