6

After unzip the tomcat9 package available on tomcat.apache.org, and have the mod_jk configured to this:

workers.tomcat_home=/opt/apache-tomcat-9.0.34
workers.java_home=/opt/jdk-13
ps=/

worker.list=ajp13_worker

worker.ajp13_worker.port=8009
worker.ajp13_worker.host=localhost
worker.ajp13_worker.type=ajp13

When I deploy a WAR to the webapps directory, and try access it, the browser shows this error:

enter image description here

in the mod_jk log, I got this:

[Sat Apr 25 08:45:49.187 2020] [16060:139700132441152] [info] jk_open_socket::jk_connect.c (816): connect to 127.0.0.1:8009 failed (errno=111)
[Sat Apr 25 08:45:49.187 2020] [16060:139700132441152] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1065): (ajp13_worker) Failed opening socket to (127.0.0.1:8009) (errno=111)
[Sat Apr 25 08:45:49.187 2020] [16060:139700132441152] [error] ajp_send_request::jk_ajp_common.c (1725): (ajp13_worker) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Sat Apr 25 08:45:49.187 2020] [16060:139700132441152] [info] ajp_service::jk_ajp_common.c (2775): (ajp13_worker) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Sat Apr 25 08:45:49.187 2020] [16060:139700132441152] [error] ajp_service::jk_ajp_common.c (2796): (ajp13_worker) connecting to tomcat failed (rc=-3, errors=2, client_errors=0).
[Sat Apr 25 08:45:49.187 2020] [16060:139700132441152] [info] jk_handler::mod_jk.c (2991): Service error=-3 for worker=ajp13_worker

my server.xml file has this section uncommented already:

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector protocol="AJP/1.3"
           address="::1"
           port="8009"
           redirectPort="8443" />

if I try access with somethid like http://mydomain:8080/app for a webapp named app, works fine. without the :8080, which should make the access go through the mod_jk, I got the error.

anyone can tell me what is wrong here?

Kleber Mota
  • 8,521
  • 31
  • 94
  • 188
  • https://stackoverflow.com/questions/62595897/tomcat-error-ajp-servicejk-ajp-common-c-ajp-send-requestjk-ajp-common-c/62597733?noredirect=1#comment110715514_62597733 – ru4ert Jun 27 '20 at 07:05
  • 5
    You should try using `127.0.0.1` instead of `localhost` in your `worker.properties`. [edit] Hum wrong, access log says `connect to 127.0.0.1:8009`, so maybe issue come from `address="::1"`. It can prevent tomcat from accepting `127.0.0.1` depending on distro used. Try removing address attribute, or put `127.0.0.1` as a value. – Genu Jul 03 '20 at 16:48
  • @Genu You are a rock star! Changing localhost to 127.0.0.1 solved my problem. Thank you! – clarmond Aug 13 '21 at 16:20
  • @Genu I concur; you're a rock star! – Emastmagy MastMagy Sep 12 '22 at 13:11
  • @Genu, another one that worked! Yes, you're a rock star! – Rogério Arantes Feb 16 '23 at 14:23

0 Answers0