views:

754

answers:

3

Hi,

I am trying to configure mod_jk to forward requests to my webapp running in tomcat. ( I read else where that mod_proxy_ajp is the way to go but want to get this figured out first). I am new to tomcat and mod_jk.

I try to access -- http://www.example.com/test/index.jsp

I get a 400 error in my apache logs after I configured mod_jk. The webapp is working fine when I test it directly in tomcat. In the mod_jk log file I see that it is trying to map the A/index.jsp but its failing with a 400. So I see that the mod_jk is getting invoked but somehow modjk is not seeing the webapp.

Any help is greatly appreciated

I am on a SuSe Linux 11 and am running apache and tomcat on the same box.

My httpd.conf is a monolithic file. In it I added the following --

<IfModule jk_module>
Alias /test/ "/srv/tomcat6/webapps/A"
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] "

JKMount        /test/ A1
JkMount     /test/* A1
JkOptions       +ForwardSSLCertChain
</IfModule>

I have the following in the workers.properties --

#Define 1 real worker using ajp13
worker.list=A
#Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.ajp13.lbfactor=50
worker.ajp13.cachesize=10
worker.ajp13.cache_timeout=600
worker.ajp13.socket_keepalive=1
worker.ajp13.socket_timeout=300

Thanks, - Vas

A: 

Did you load the module?

 LoadModule jk_module [path to it]

The directive will be true if it is loaded already or compiled in I believe.

Sean A.O. Harney
Yes. I have the directive to load the module -- LoadModule jk_module modules/mod_jk.so
A: 

Your worker is called A but your JkMount maps to A1. You should have one entry like this,

JkMount /test/* A

I used both mod_jk and mod_proxy_ajp. Under heavy load, mod_jk performs better because the mod_jk connection is more persistent. mod_proxy is indeed much easier to setup.

EDIT: The worker configuration is not correct either. It should be something like this,

#Define 1 real worker using ajp13
worker.list=A
#Set properties for worker1 (ajp13)
worker.A.type=ajp13
worker.A.host=localhost
worker.A.port=8009
worker.A.lbfactor=50
worker.A.cachesize=10
worker.A.cache_timeout=600
worker.A.socket_keepalive=1
worker.A.socket_timeout=300
ZZ Coder
Hi,That was an error in the post. Thanks for looking into this but changing it to A does not work either.So do you say it looks correct otherwise?-Vas
The worker.properties is wrong also. See my edited answer.
ZZ Coder
Thanks a lot!! I was not thinking straight yesterday. Spent a lot of time setting up apache, tomcat and mod_jk. Glad that its a copy paste error. \nThanks also for the mod_jk vs mod_proxy clarification. From what I read I too thought mod_jk is better but was confused after reading articles that mod_jk is dead. Will stick to mod_jk- Vas