Apache, mod_jk not serving tomcat

Posted on November 15, 2007 in How-to

I was trying to set up Apache mod_jk to serve up my jboss traffic without loadbalancing and I was running into the errors below. My machine is running Red Hat Enterprise Linux ES release 4 with Apache2.

[Wed Nov 14 19:00:28 2007][27581:63168] [debug] do_shm_open::jk_shm.c (415): Attached shared memory [8] size=28672 free=28672 addr=0xb7e5d000
[Wed Nov 14 19:00:28 2007][27581:63168] [debug] do_shm_open::jk_shm.c (429): Reseting the shared memory for child 8
[Wed Nov 14 19:00:28 2007][27581:63168] [debug] do_shm_open_lock::jk_shm.c (258): Duplicated shared memory lock /etc/httpd/logs/jk.shm.27572.lock
[Wed Nov 14 19:00:28 2007][27581:63168] [debug] jk_child_init::mod_jk.c (2651): Attached shm:/etc/httpd/logs/jk.shm.27572
[Wed Nov 14 19:00:28 2007][27581:63168] [debug] jk_child_init::mod_jk.c (2661): Initialized mod_jk/1.2.23
[Wed Nov 14 19:00:28 2007][27582:63168] [debug] do_shm_open::jk_shm.c (415): Attached shared memory [9] size=28672 free=28672 addr=0xb7e5d000
[Wed Nov 14 19:00:28 2007][27582:63168] [debug] do_shm_open::jk_shm.c (429): Reseting the shared memory for child 9
[Wed Nov 14 19:00:28 2007][27582:63168] [debug] do_shm_open_lock::jk_shm.c (258): Duplicated shared memory lock /etc/httpd/logs/jk.shm.27572.lock
[Wed Nov 14 19:00:28 2007][27582:63168] [debug] jk_child_init::mod_jk.c (2651): Attached shm:/etc/httpd/logs/jk.shm.27572
[Wed Nov 14 19:00:28 2007][27582:63168] [debug] jk_child_init::mod_jk.c (2661): Initialized mod_jk/1.2.23
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] map_uri_to_worker::jk_uri_worker_map.c (589): Attempting to map URI '/jmx-console/' from 7 maps
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] map_uri_to_worker::jk_uri_worker_map.c (601): Attempting to map context URI '/jmx-console/*=node3' source 'uriworkermap'
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] map_uri_to_worker::jk_uri_worker_map.c (616): Found a wildchar match '/jmx-console/*=node3'
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] jk_handler::mod_jk.c (2111): Into handler jakarta-servlet worker=node3 r->proxyreq=0
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] wc_get_worker_for_name::jk_worker.c (114): found a worker node3
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] wc_maintain::jk_worker.c (321): Maintaining worker node3
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] wc_maintain::jk_worker.c (321): Maintaining worker loadbalancer
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] wc_get_name_for_type::jk_worker.c (290): Found worker type 'ajp13'
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] init_ws_service::mod_jk.c (607): Service protocol=HTTP/1.1 method=GET host=(null) addr=192.168.151.112 name=lin04.unitedfuture.com port=80 auth=(null) user=(null) laddr=192.168.151.20 raddr=192.168.151.112
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] ajp_get_endpoint::jk_ajp_common.c (2343): acquired connection pool slot=0
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] ajp_marshal_into_msgb::jk_ajp_common.c (548): ajp marshaling done
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] ajp_service::jk_ajp_common.c (1796): processing node3 with 2 retries
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] jk_open_socket::jk_connect.c (335): socket TCP_NODELAY set to On
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] jk_open_socket::jk_connect.c (348): socket SO_KEEPALIVE set to On
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] jk_open_socket::jk_connect.c (398): timeout 120 set for socket=16
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] jk_open_socket::jk_connect.c (433): trying to connect socket 16 to 127.0.0.1:8009
[Wed Nov 14 19:00:42 2007][27575:63168] [info] jk_open_socket::jk_connect.c (451): connect to 127.0.0.1:8009 failed (errno=111)
[Wed Nov 14 19:00:42 2007][27575:63168] [info] ajp_connect_to_endpoint::jk_ajp_common.c (876): Failed opening socket to (127.0.0.1:8009) (errno=111)
[Wed Nov 14 19:00:42 2007][27575:63168] [info] ajp_send_request::jk_ajp_common.c (1273): (node3) error connecting to the backend server (errno=111)
[Wed Nov 14 19:00:42 2007][27575:63168] [info] ajp_service::jk_ajp_common.c (1941): (node3) sending request to tomcat failed, recoverable operation attempt=1
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] jk_open_socket::jk_connect.c (335): socket TCP_NODELAY set to On
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] jk_open_socket::jk_connect.c (348): socket SO_KEEPALIVE set to On
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] jk_open_socket::jk_connect.c (398): timeout 120 set for socket=16
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] jk_open_socket::jk_connect.c (433): trying to connect socket 16 to 127.0.0.1:8009
[Wed Nov 14 19:00:42 2007][27575:63168] [info] jk_open_socket::jk_connect.c (451): connect to 127.0.0.1:8009 failed (errno=111)
[Wed Nov 14 19:00:42 2007][27575:63168] [info] ajp_connect_to_endpoint::jk_ajp_common.c (876): Failed opening socket to (127.0.0.1:8009) (errno=111)
[Wed Nov 14 19:00:42 2007][27575:63168] [info] ajp_send_request::jk_ajp_common.c (1273): (node3) error connecting to the backend server (errno=111)
[Wed Nov 14 19:00:42 2007][27575:63168] [info] ajp_service::jk_ajp_common.c (1941): (node3) sending request to tomcat failed, recoverable operation attempt=2
[Wed Nov 14 19:00:42 2007][27575:63168] [error] ajp_service::jk_ajp_common.c (1953): (node3) Connecting to tomcat failed. Tomcat is probably not started or is listening on the wrong port
[Wed Nov 14 19:00:42 2007][27575:63168] [debug] ajp_done::jk_ajp_common.c (2286): recycling connection pool slot=0 for worker node3
[Wed Nov 14 19:00:42 2007]node3 lin04.unitedfuture.com 0.000743
[Wed Nov 14 19:00:42 2007][27575:63168] [info] jk_handler::mod_jk.c (2254): Service error=0 for worker=node3

The solution was to specifically identify the host machine in the workers.properties file.


[root@]# cat /etc/httpd/conf/workers.properties
# Define list of workers that will be used
# for mapping requests
worker.list=jbossworker,status
# Define jbossworker
worker.jbossworker.port=8009
worker.jbossworker.host=jboss1.example.com
worker.jbossworker.type=ajp13
# Status worker for managing load balancer
worker.status.type=status
I hope that helps some people.