Mod_jk setup problems
Hi, I am running Tomcat5.5.9 and JDK1.5.0_04 with a Apache 1.3 webserver on FreeBSD 5.3. I can't seem to get anything to successfully pass though the mod_jk connector to the webapp. My mod_jk.conf , workers.properties are as follows. $ less mod_jk.conf # JkWorkersFile /usr/local/etc/apache/workers.properties JkLogFile /var/log/jk.log JkLogLevel debug ServerName localhost # Sample JkMounts. Replace these with the paths you would # like to mount from your JSP server. JkMount /*.jsp worker1 JkMount /servlet/* worker1 JkMount /examples/* worker1 JkMount /docstore worker1 JkMount /docstore/* worker1 mod_jk.conf (END) $ less workers.properties # Setting Tomcat & Java Home workers.tomcat_home=/usr/local/jakarta-tomcat5.5/ workers.java_home=/usr/local/jdk1.5.0/ ps=/ # Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.reclycle_timeout=300 workers.properties (END) When I start Tomcat & Apache... is seems to start ok , but I get this output in the jk.log file ... $ less /var/log/jk.log [Sun Sep 18 21:37:30 2005] [6691:] [error] jk_init::mod_jk.c (2035): Initializing shm:/usr/local/logs/jk-runtime-status errno=2 [Sun Sep 18 21:37:30 2005] [6691:] [debug] uri_worker_map_open::jk_uri_worker_map.c (323): rule map size is 0 [Sun Sep 18 21:37:30 2005] [6691:] [debug] build_worker_map::jk_worker.c (236): creating worker worker1 [Sun Sep 18 21:37:30 2005] [6691:] [debug] wc_create_worker::jk_worker.c (141): about to create instance worker1 of ajp13 [Sun Sep 18 21:37:30 2005] [6691:] [debug] wc_create_worker::jk_worker.c (154): about to validate and init worker1 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_validate::jk_ajp_common.c (1806): worker worker1 contact is 'localhost:8009' [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_init::jk_ajp_common.c (1895): setting socket keepalive to 1 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_init::jk_ajp_common.c (1934): setting socket timeout to -1 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_init::jk_ajp_common.c (1938): setting socket buffer size to 0 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_init::jk_ajp_common.c (1942): setting connection recycle timeout to 0 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_init::jk_ajp_common.c (1946): setting cache timeout to 600 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_init::jk_ajp_common.c (1950): setting connect timeout to 0 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_init::jk_ajp_common.c (1954): setting reply timeout to 0 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_init::jk_ajp_common.c (1958): setting prepost timeout to 0 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_init::jk_ajp_common.c (1962): setting recovery opts to 0 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_init::jk_ajp_common.c (1966): setting number of retries to 3 [Sun Sep 18 21:37:30 2005] [6691:] [debug] ajp_create_endpoint_cache::jk_ajp_common.c (1843): setting connection cache size to 10 [Sun Sep 18 21:37:30 2005] [6691:] [debug] build_worker_map::jk_worker.c (248): removing old worker1 worker [Sun Sep 18 21:39:14 2005] [7500:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/docstore/' from 0 maps [Sun Sep 18 22:48:11 2005] [7501:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/' from 0 maps [Sun Sep 18 22:48:11 2005] [7501:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/index.html' from 0 maps [Sun Sep 18 22:48:11 2005] [7501:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/HEADER.html' from 0 maps [Sun Sep 18 22:48:11 2005] [7501:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/README.html' from 0 maps [Sun Sep 18 23:54:42 2005] [7503:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/' from 0 maps [Sun Sep 18 23:54:42 2005] [7503:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/index.html' from 0 maps [Sun Sep 18 23:54:42 2005] [7503:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/HEADER.html' from 0 maps [Sun Sep 18 23:54:42 2005] [7503:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/README.html' from 0 maps [Sun Sep 18 23:55:51 2005] [7507:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/' from 0 maps [Sun Sep 18 23:55:51 2005] [7507:] [debug] map_uri_to_worker::jk_uri_worker_map.c (449): Attempting to map URI '/index.html' from 0 map
Re: Mod_jk setup problems
A couple of things here. I'll try to insert comment where appropriate. --- Don Boling <[EMAIL PROTECTED]> wrote: > I can't seem to get anything to successfully pass > though the mod_jk connector to the webapp. What version of mod_jk? > My mod_jk.conf , workers.properties are as follows. > > $ less mod_jk.conf > # > JkWorkersFile > /usr/local/etc/apache/workers.properties > JkLogFile /var/log/jk.log > JkLogLevel debug Later versions of mod_jk need JkShmFile on UNIX. > JkMount /*.jsp worker1 > JkMount /servlet/* worker1 > JkMount /examples/* worker1 > JkMount /docstore worker1 > JkMount /docstore/* worker1 My installs of Tomcat on Linux and Windows do not have an examples web application. I have /jsp-examples and a /servlets-examples contexts. You might try: JkMount /jsp-examples/*.jsp worker1 JkMount /servlet-examples/servlet/* worker1 I don't know what your other applications are, but I'll comment on a general setup in a bit. > # Define 1 real worker using ajp13 > worker.list=worker1 > # Set properties for worker1 (ajp13) > worker.worker1.type=ajp13 > worker.worker1.host=localhost > worker.worker1.port=8009 > worker.worker1.lbfactor=50 > worker.worker1.cachesize=10 > worker.worker1.cache_timeout=600 > worker.worker1.socket_keepalive=1 > worker.worker1.reclycle_timeout=300 You probably don't need worker.worker1.lbfactor since you're not using load balancing. Recycle (worker.worker1.reclycle_timeout) needs to be spelled correctly. [Lots of log stuff deleted] With the exceptin of docstore, I did not see anything that matched your JkMount statements. Since there was no match, no requests were forwarded. In general, you will probably not have $CATALINA_HOME/webapps and Apache's DocumentRoot ovelapping each other. Since they don't overlap, Apache will not know anything about static files (html, css, etc.) that live in $CATALINA_HOME/webapps. You can use Directory and Alias directives in Apache to set up access and map the directory into a URI space that Apache knows about. With later versions of mod_jk, you can use JkAutoAlias to map directories for you. From the documentation at http://jakarta.apache.org/tomcat/connectors-doc/config/apache.html JkAutoAlias /opt/tomcat/webapps Then you can use JkMount to map certain requests (*.jsp, /*/servlet/*). JkMount /jsp-examples/*.jsp worker1 The value of JkAutoAlias appears to be prepended to the JkMount directive to find the physical location. I've not used JkAutoAlias, but this appears to be a nice alternative to Directory and Alias directives in httpd.conf. In short: 1. Add JkShmFile to httpd.conf 2. Remove lbfactor from workers.properties 3. Change the spelling of recycle 4. Use JkAutoAlias or Directory / Alias directives to put the appropriate directories within Apache's document and URI space. I hope that gets you up and running. /mde/ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mod_jk setup problems
Thanks Mark, I this helped a lot ... I'll insert comments as well... ;) Mark Eggers wrote: A couple of things here. I'll try to insert comment where appropriate. --- Don Boling <[EMAIL PROTECTED]> wrote: I can't seem to get anything to successfully pass though the mod_jk connector to the webapp. What version of mod_jk? mod_jk 1.2.14 My mod_jk.conf , workers.properties are as follows. $ less mod_jk.conf # JkWorkersFile /usr/local/etc/apache/workers.properties JkLogFile /var/log/jk.log JkLogLevel debug Later versions of mod_jk need JkShmFile on UNIX. I removed the loadbalance setting... do I still need this? I have not seen any reference as to what this should be set to. JkMount /*.jsp worker1 JkMount /servlet/* worker1 JkMount /examples/* worker1 JkMount /docstore worker1 JkMount /docstore/* worker1 My installs of Tomcat on Linux and Windows do not have an examples web application. I have /jsp-examples and a /servlets-examples contexts. You might try: JkMount /jsp-examples/*.jsp worker1 JkMount /servlet-examples/servlet/* worker1 I corrected these, thanks for pointing those out... I don't know what your other applications are, but I'll comment on a general setup in a bit. # Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=50 worker.worker1.cachesize=10 worker.worker1.cache_timeout=600 worker.worker1.socket_keepalive=1 worker.worker1.reclycle_timeout=300 You probably don't need worker.worker1.lbfactor since you're not using load balancing. Recycle (worker.worker1.reclycle_timeout) needs to be spelled correctly. oops, thanks ... new mod_jk.conf is ... $ less mod_jk.conf # JkWorkersFile /usr/local/etc/apache/workers.properties JkLogFile /var/log/jk.log JkLogLevel debug ServerName localhost # Sample JkMounts. Replace these with the paths you would # like to mount from your JSP server. JkMount /*.jsp worker1 JkMount /servlet-examples/servlet/* worker1 JkMount /jsp-examples/*.jsp worker1 JkMount /docstore worker1 JkMount /docstore/* worker1 mod_jk.conf (END) [Lots of log stuff deleted] With the exceptin of docstore, I did not see anything that matched your JkMount statements. Since there was no match, no requests were forwarded. In general, you will probably not have $CATALINA_HOME/webapps and Apache's DocumentRoot ovelapping each other. Since they don't overlap, Apache will not know anything about static files (html, css, etc.) that live in $CATALINA_HOME/webapps. You can use Directory and Alias directives in Apache to set up access and map the directory into a URI space that Apache knows about. With later versions of mod_jk, you can use JkAutoAlias to map directories for you. From the documentation at http://jakarta.apache.org/tomcat/connectors-doc/config/apache.html JkAutoAlias /opt/tomcat/webapps Then you can use JkMount to map certain requests (*.jsp, /*/servlet/*). JkMount /jsp-examples/*.jsp worker1 The value of JkAutoAlias appears to be prepended to the JkMount directive to find the physical location. I've not used JkAutoAlias, but this appears to be a nice alternative to Directory and Alias directives in httpd.conf. I am trying the JkAutoAlias route ... almost there. In short: 1. Add JkShmFile to httpd.conf 2. Remove lbfactor from workers.properties 3. Change the spelling of recycle 4. Use JkAutoAlias or Directory / Alias directives to put the appropriate directories within Apache's document and URI space. I hope that gets you up and running. /mde/ I have it running now with 'less' errors in jk.log ... I have noticed that 8080 is not responding any more if I just try to hit TC directly so I think, correct me if I'm wrong... this won't work even if setup correctly, until I fix that. Thanks again, Don - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mod_jk setup problems
Glad I was able to help a little bit. In my experience (Linux,Solaris,Win/2K), 8080 should always work if you have the Connector configured. If you can't get to http://localhost:8080/jsp-examples/ running, then there is something else amiss. In your httpd.conf file, I still didn't see something like the following: JkShmFile /var/log/memory.shm This wasn't necessary in 1.2.6 and may not be necessary in 1.2.14, but according to the documentation it's used on UNIX platforms. In workers.properties lbfactor is used to set the relative weight of a worker when you're doing load balancing. Since you're not doing load balancing, letting it default to 1 should be fine. You have two JkMounts for docstore. I'm thinking that only: JkMount /docstore/* worker1 is necessary. If the entire web application (including static files) lives in $CATALINA_HOME/webapps, then the Apache process will need access to those directories and files. Finally, a long time ago the order of startup was important. I think it was Tomcat first, then Apache. It's been a while, and right now I'm on the Windows side of this machine so I can't check. The order of startup issue went away with Apache 2.0.x, but it may still be an issue with your environment (Apache 1.3.x). I would be interested in seeing your error logs from mod_jk as well as seeing what catalina.out has in it when you try to get to a web application via port 8080. Hope this gives you some avenues to explore. /mde/ __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]