I’m a newbie to apache/tomcat .

I’m working on a setting up apache webserver Infront of the tomcat server, I have apache webserver on one host(10.176.165.21), and tomcat on a other host (10.176.165.22). Both are on OS RHEL 7.9.

On the Web server host, I have installed the httpd and configured to connect with tomcat host. Sharing the config below.

Apache version: Server version: Apache/2.4.6 (Red Hat Enterprise Linux)

Tomcat Server version: Apache Tomcat/9.0.80

/etc/httpd/conf.d/workers.properties:

worker.list=worker1

worker.worker1.type=ajp13
worker.worker1.host=10.176.165.22
worker.worker1.port=8009

I’m using the modjk connector for establishing the connectivity b/n apacehe and tomcat.

modjk config:

Load mod_jk module

LoadModule jk_module modules/mod_jk.so

Specify the workers for Tomcat instances

JkWorkersFile /etc/httpd/conf.d/workers.properties

Configure the mod_jk log file

JkLogFile /var/log/httpd/mod_jk.log

Set the log level

JkLogLevel info

Mount your web application to Tomcat

JkMount /* worker1

Tomcat :

On the tomcat host : the server config has below AJP connector config has been set.

8009 port is listening on tomcat server and enabled in required firewalls.

[Thu Oct 05 04:37:08.658 2023] [ZR51tP-yAAFF7pqs0XfINAAAAAM] [26749:140710419421312] [info] jk_open_socket::jk_connect.c (818): connect to 10.176.165.22:8009 failed (errno=111)
[Thu Oct 05 04:37:08.658 2023] [ZR51tP-yAAFF7pqs0XfINAAAAAM] [26749:140710419421312] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1092): (worker1) Failed opening socket to (10.176.165.22:8009) (errno=111)
[Thu Oct 05 04:37:08.658 2023] [ZR51tP-yAAFF7pqs0XfINAAAAAM] [26749:140710419421312] [error] ajp_send_request::jk_ajp_common.c (1768): (worker1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Thu Oct 05 04:37:08.658 2023] [ZR51tP-yAAFF7pqs0XfINAAAAAM] [26749:140710419421312] [info] ajp_service::jk_ajp_common.c (2892): (worker1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)

I’m looking for help ,

Thanks,

Raj

5 Spice ups

Hey there,

two things seem off and worth looking into maybe.

1.) This

“[error] ajp_send_request::jk_ajp_common.c (1768): (worker1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)”

kinda gives the impression the TomCat service ain’t running or is hanging. Try restarting/starting it (systemctl restart/start …)

2.) in your Tomcat config you loopback is set as “::1” which is IPv6, but you don’t seem to use IPv6 here anywhere apparently. Try setting it to “127.0.0.1” or “localhost” (the IPv4 equivalent of “::1”)

Good luck

jas