简体   繁体   中英

Apache 2.4.29 and mod_jk 1.2.42 not forwarding to tomcat

I'm working on an apache 2.4.29 installation with mod_jk 1.2.42 against a tomcat 8.5.11.
My problem is that the apache + mod_jk is not forwarding the request to the tomcat.
We have a previous apache installation (2.2.31) with mod_jk (1.2.25) against the same tomcat and its working correctly.

This is the only error/something out of the ordinary we are getting on the mod_jk.log file:

[Fri Dec 08 08:02:26.659 2017] [32025:140457247692544] [debug] jk_child_init::mod_jk.c (3478): Initialized mod_jk/1.2.42
[Fri Dec 08 08:02:41.987 2017] [31596:140455607994112] [debug] jk_translate::mod_jk.c (3859): missing uri map for mycompany.com:/SCDO
[Fri Dec 08 08:02:41.987 2017] [31596:140455607994112] [debug] jk_map_to_storage::mod_jk.c (4027): missing uri map for mycompany.com:/SCDO
[Fri Dec 08 08:02:42.007 2017] [31596:140455607994112] [debug] jk_translate::mod_jk.c (3859): missing uri map for mycompany.com:/error.html
[Fri Dec 08 08:02:42.007 2017] [31596:140455607994112] [debug] jk_map_to_storage::mod_jk.c (4027): missing uri map for mycompany.com:/error.html
[Fri Dec 08 08:19:53.665 2017] [31598:140457247692544] [debug] wc_shutdown::jk_worker.c (390): Shutting down worker ajp13

On the access log we are only getting a 404 error.

This is the include of the httpd.conf:

Include conf/mod_jk.conf

This is the mod_jk configuration:

<IfModule !mod_jk.c>
  LoadModule jk_module "/opt/apache-2.4.29/modules/mod_jk.so"
</IfModule>

JkWorkersFile "/opt/apache-2.4.29/conf/workers.properties"
#enable this log only for troubleshooting
JkLogFile "/opt/apache-2.4.29/logs/mod_jk.log"
JkLogLevel debug

    JkMount /servlets-examples ajp13
    JkMount /servlets-examples/* ajp13

    JkMount /jsp-examples ajp13
    JkMount /jsp-examples/* ajp13

    JkMount /probe ajp13
    JkMount /probe/* ajp13

   JkMount /SCDO  ajp13
   JkMount /SCDO/* ajp13

   JkMount /test  ajp13
   JkMount /test/* ajp13

   JkMount /mod_jk_status mystatus

This is the workers.properties:

worker.list=ajp13
worker.ajp13.port=8010
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.socket_timeout=300
worker.ajp13.max_packet_size=20000


worker.list=mystatus
worker.mystatus.type=status

Any idea will be appreciated.

I had the SAME issue, it was driving me crazy. It started when I loaded LetsEncrypt... Here's the fix that worked for me: Add a "JkMountCopy On" to each VirtualHost section.

For example:

In the /etc/httpd/conf.d/ folder, edit any .conf files that have a VirtualHost definition (grep VirtualHost *.conf) - there may be more than one:

<VirtualHost _default_:443>

#Add the following line
JkMountCopy On 
....

That's just an example, it might not say default :443 - the other one was for port 80 as you might guess. If you have a VirtualHost section in your main httpd.conf, it probably needs it as well. I didn't have one.

and sorry for the previous answer.
You must check the timeout and maxPostSize* values ​​for the AJP 1.3 connector in the server.xml file of your Tomcat.

*From Tomcat 7 and superiors, the maxPostSize value must be less than 0 to disable it.

Regards.

Let me add one more possible reason for the issue in Apache => Tomcat communication issues via AJP.

In my case I have installed libapache2-mod-jk library on the machine, which creates a separate workers file. I checked the current file on the host:

find / -name "workers.properties"

and got:

/etc/apache2/workers.properties
/etc/libapache2-mod-jk/workers.properties

So all the time before:

  • I was working on the wrong file (inside libapache2-mod-jk), because I did not point Apache to it.
  • Apache was using it's default file (inside apache2) and the wrong worker identifier in the config, because I took it from the wrong file.

Just in case you are facing a similar issue and you are sure you have tried everything - check this one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM