Search code examples
apachetomcatapache2.4mod-jk

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.


Solution

  • 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.