You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by murthy gandikota <mu...@yahoo.com> on 2008/04/16 19:23:25 UTC

Apache 2.2.4 + Tomcat 5.5 + Mod_jk 1.2 causing login loop

We have 2 tomcat servers being load-balanced by a front-end apache 
server using mod-jk. Whenever we open a new browser and point the url 
to the http://fakedomain.com/xyz/content/home/home.jsf and submit the 
form, we get back the same form again with sessionid. Effectively, we 
end up logging in twice. In other words, the form is fetched twice and 
submitted twice. 
  Can anyone please guess what's going on ? 
  Here are the worker.properties: 
  worker.list=loadbalancer 
worker.loadbalancer.type=lb 
worker.loadbalancer.balance_workers=worker1,worker2 
  worker.worker1.type=ajp13 
worker.worker1.host=172.16.170.30 
worker.worker1.port=8009 
worker.worker1.lbfactor=1 
worker.worker1.retries=1 
  worker.worker2.type=ajp13 
worker.worker2.host=172.16.170.35 
worker.worker2.port=8009 
worker.worker2.lbfactor=1 
worker.worker2.retries=1 
  This is mod-jk.conf 
   # Load mod_jk module 
# Specify the filename of the mod_jk lib 
LoadModule jk_module modules/mod_jk.so 
  # Where to find workers.properties 
JkWorkersFile conf/worker.properties 
  # Where to put jk logs 
JkLogFile logs/mod_jk.log 
  # Set the jk log level [debug/error/info] 
JkLogLevel debug 
  # Select the log format 
JkLogStampFormat  "[%a %b %d %H:%M:%S %Y]" 
  # JkOptions indicates to send SSK KEY SIZE 
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories 
  # JkRequestLogFormat 
JkRequestLogFormat "%w %V %T" 
  # Mount your applications 
JkMount /nva/* loadbalancer 
JkMount /dwr/* loadbalancer 
#JkMount /es/* es 
JkMount /es/* loadbalancer 
  # You can use external file for mount points. 
# It will be checked for updates each 60 seconds. 
# The format of the file is: /url=worker 
# /examples/*=loadbalancer 
JkMountFile conf/uriworkermap.properties 
  # Add shared memory. 
# This directive is present with 1.2.10 and 
# later versions of mod_jk, and is needed for 
# for load balancing to work properly 
JkShmFile logs/jk.shm 
  # Add jkstatus for managing runtime data 
<Location /jkstatus/> 
    JkMount status 
    Order deny,allow 
    Deny from all 
    Allow from 127.0.0.1 
</Location> 
  Finally in httpd.conf we have this line 
  Include conf/mod-jk.conf 
  If don't see any errors. What should I be looking in the debug output? 
  Thanks 



       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: Apache 2.2.4 + Tomcat 5.5 + Mod_jk 1.2 causing login loop

Posted by Felix Schumacher <fe...@internetallee.de>.
On Wed, April 16, 2008 7:23 pm, murthy gandikota wrote:
> We have 2 tomcat servers being load-balanced by a front-end apache
> server using mod-jk. Whenever we open a new browser and point the url
> to the http://fakedomain.com/xyz/content/home/home.jsf and submit the
> form, we get back the same form again with sessionid. Effectively, we
> end up logging in twice. In other words, the form is fetched twice and
> submitted twice.
Have you set to different jvmRoute attributes in the conf/server.xml for
the two tomcats?

Like
 ...
 <Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">
 ...
for one tomcat and
 ...
 <Engine name="Catalina" defaultHost="localhost" jvmRoute="worker2">
 ...
for the other one? Otherwise mod_jk will not be able to route the session
to the right tomcat (which is the one which generated the session).

Or you will have to set up session replication for the tomcats.

Bye Felix

>   Can anyone please guess what's going on ?
>   Here are the worker.properties:
>   worker.list=loadbalancer
> worker.loadbalancer.type=lb
> worker.loadbalancer.balance_workers=worker1,worker2
>   worker.worker1.type=ajp13
> worker.worker1.host=172.16.170.30
> worker.worker1.port=8009
> worker.worker1.lbfactor=1
> worker.worker1.retries=1
>   worker.worker2.type=ajp13
> worker.worker2.host=172.16.170.35
> worker.worker2.port=8009
> worker.worker2.lbfactor=1
> worker.worker2.retries=1
>   This is mod-jk.conf
>    # Load mod_jk module
> # Specify the filename of the mod_jk lib
> LoadModule jk_module modules/mod_jk.so
>   # Where to find workers.properties
> JkWorkersFile conf/worker.properties
>   # Where to put jk logs
> JkLogFile logs/mod_jk.log
>   # Set the jk log level [debug/error/info]
> JkLogLevel debug
>   # Select the log format
> JkLogStampFormat  "[%a %b %d %H:%M:%S %Y]"
>   # JkOptions indicates to send SSK KEY SIZE
> JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
>   # JkRequestLogFormat
> JkRequestLogFormat "%w %V %T"
>   # Mount your applications
> JkMount /nva/* loadbalancer
> JkMount /dwr/* loadbalancer
> #JkMount /es/* es
> JkMount /es/* loadbalancer
>   # You can use external file for mount points.
> # It will be checked for updates each 60 seconds.
> # The format of the file is: /url=worker
> # /examples/*=loadbalancer
> JkMountFile conf/uriworkermap.properties
>   # Add shared memory.
> # This directive is present with 1.2.10 and
> # later versions of mod_jk, and is needed for
> # for load balancing to work properly
> JkShmFile logs/jk.shm
>   # Add jkstatus for managing runtime data
> <Location /jkstatus/>
>     JkMount status
>     Order deny,allow
>     Deny from all
>     Allow from 127.0.0.1
> </Location>
>   Finally in httpd.conf we have this line
>   Include conf/mod-jk.conf
>   If don't see any errors. What should I be looking in the debug output?
>   Thanks
>
>
>
>
> ---------------------------------
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it
> now.



---------------------------------------------------------------------
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: Apache 2.2.4 + Tomcat 5.5 + Mod_jk 1.2 causing login loop

Posted by murthy gandikota <mu...@yahoo.com>.
The problem was traced to duplicate jvmRoute in the Tomcat's server.xml

murthy gandikota <mu...@yahoo.com> wrote:  We have 2 tomcat servers being load-balanced by a front-end apache 
server using mod-jk. Whenever we open a new browser and point the url 
to the http://fakedomain.com/xyz/content/home/home.jsf and submit the 
form, we get back the same form again with sessionid. Effectively, we 
end up logging in twice. In other words, the form is fetched twice and 
submitted twice. 
Can anyone please guess what's going on ? 
Here are the worker.properties: 
worker.list=loadbalancer 
worker.loadbalancer.type=lb 
worker.loadbalancer.balance_workers=worker1,worker2 
worker.worker1.type=ajp13 
worker.worker1.host=172.16.170.30 
worker.worker1.port=8009 
worker.worker1.lbfactor=1 
worker.worker1.retries=1 
worker.worker2.type=ajp13 
worker.worker2.host=172.16.170.35 
worker.worker2.port=8009 
worker.worker2.lbfactor=1 
worker.worker2.retries=1 
This is mod-jk.conf 
# Load mod_jk module 
# Specify the filename of the mod_jk lib 
LoadModule jk_module modules/mod_jk.so 
# Where to find workers.properties 
JkWorkersFile conf/worker.properties 
# Where to put jk logs 
JkLogFile logs/mod_jk.log 
# Set the jk log level [debug/error/info] 
JkLogLevel debug 
# Select the log format 
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" 
# JkOptions indicates to send SSK KEY SIZE 
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories 
# JkRequestLogFormat 
JkRequestLogFormat "%w %V %T" 
# Mount your applications 
JkMount /nva/* loadbalancer 
JkMount /dwr/* loadbalancer 
#JkMount /es/* es 
JkMount /es/* loadbalancer 
# You can use external file for mount points. 
# It will be checked for updates each 60 seconds. 
# The format of the file is: /url=worker 
# /examples/*=loadbalancer 
JkMountFile conf/uriworkermap.properties 
# Add shared memory. 
# This directive is present with 1.2.10 and 
# later versions of mod_jk, and is needed for 
# for load balancing to work properly 
JkShmFile logs/jk.shm 
# Add jkstatus for managing runtime data 

JkMount status 
Order deny,allow 
Deny from all 
Allow from 127.0.0.1 

Finally in httpd.conf we have this line 
Include conf/mod-jk.conf 
If don't see any errors. What should I be looking in the debug output? 
Thanks 




---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.