Apache not using desired ports on workers.properties - apache

We've configured Apache to redirect to an instance of tomcat through a diferent port of the AJP default 8009 . It only works for the default port but it's not working with the one we set (8109) on the worker.properties This is our scenario
worker.properties on /etc/apache2
worker.list=sacmimexico
# Set properties for sacmimexico
worker.sacmimexico.type=ajp13
worker.sacmimexico.host=localhost
worker.sacmimexico.port=8109
server.xml on /usr/share/instance-tomcat-7.0.42/sacmimexico/conf/
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8109" protocol="AJP/1.3" redirectPort="8143" />
mod_jk.log on /var/log/apache2
[Wed Oct 14 05:29:18 2015] [17752:140024424515392] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[Wed Oct 14 05:29:18 2015] [17753:140024424515392] [info] init_jk::mod_jk.c (3189): mod_jk/1.2.30 initialized
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] jk_open_socket::jk_connect.c (622): connect to 127.0.0.1:8009 failed (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening socket to (127.0.0.1:8009) (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [error] ajp_send_request::jk_ajp_common.c (1585): (sacmimexico) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_service::jk_ajp_common.c (2540): (sacmimexico) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] jk_open_socket::jk_connect.c (622): connect to 127.0.0.1:8009 failed (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_connect_to_endpoint::jk_ajp_common.c (959): Failed opening socket to (127.0.0.1:8009) (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [error] ajp_send_request::jk_ajp_common.c (1585): (sacmimexico) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] ajp_service::jk_ajp_common.c (2540): (sacmimexico) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [error] ajp_service::jk_ajp_common.c (2559): (sacmimexico) connecting to tomcat failed.
[Wed Oct 14 05:29:22 2015] sacmimexico 199.187.122.163 0.100588
[Wed Oct 14 05:29:22 2015] [17757:140024328361728] [info] jk_handler::mod_jk.c (2618): Service error=-3 for worker=sacmimexico
jk.conf on /etc/apache2/mods-available
<IfModule mod_jk.c>
JkWorkersFile "/etc/apache2/workers.properties"
JkLogFile "/var/log/apache2/mod_jk.log"
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
</IfModule>
default on /etc/apache2/sites-available
JkMount /sacmimexico/* sacmimexico
Versions:
Apache 2 :Apache/2.2.16 (Debian)
Tomcat 7 : Apache Tomcat/7.0.42
mod-jk : 1.2.30-1squeeze1
We know that Tomcat is working on that port 8109
Anyone knows what's happening?
Thanks
Albert

The problem were wrong carachters on workers.properties due to bad edit.
I check it with cat -A workers.properties and then create a new one from scratch.

I faced the exact same issue. The fix for this issue is to change the AJP port to a different range. The port 8109 was getting blocked by SELinux in my CentOS /Red Hat. So I changed the AJP port to 81 on woker.proberties as well as Tomcat server.xml. Thus the issue got fixed.

Related

mod_jk unable to connect with tomcat9

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:
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?

Apache Crashes AH00295: caught SIGTERM, shutting down[systemctl]

I built apache-httpd-2.4.20 from the source and installed properly.
I have created apphttpd.service under /etc/systemd/system.
Script
[Unit]
Description=Apache Web Server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
TimeoutStartSec=600
PIDFile=/usr/local/apache/logs/httpd.pid
ExecStart=/usr/local/apache/bin/apachectl -k start
ExecStop=/usr/local/apache/bin/apachectl -k stop
ExecReload=/usr/local/apache/bin/apachectl -k graceful
Restart=on-abort
PrivateTmp=true
LimitNOFILE=infinity
#User=root
#Group=root
[Install]
WantedBy=multi-user.target
when i perform systemctl start apphttpd, got message started Apache Web Server,
Status Log
**systemctl status -l apphttpd**
apphttpd.service - Apache Web Server
Loaded: loaded (/etc/systemd/system/apphttpd.service; enabled)
Active: inactive (dead) since Wed 2018-06-13 21:45:20 SGT; 14min ago
Process: 112124 ExecStop=/usr/local/apache/bin/apachectl -k stop (code=exited, status=0/SUCCESS)
Process: 112118 ExecStart=/usr/local/apache/bin/apachectl -k start (code=exited, status=0/SUCCESS)
Main PID: 112118 (code=exited, status=0/SUCCESS)
Jun 13 21:45:20 <host> systemd[1]: Started Apache Web Server.
but the services are not started actually.
error_log information:
[Wed Jun 13 21:45:20.873135 2018] [core:debug] [pid 112123:tid 139709837686656] log.c(1546): AH02639: Using SO_REUSEPORT: yes (1)
[Wed Jun 13 21:45:20.873145 2018] [mpm_worker:debug] [pid 112123:tid 139709837686656] worker.c(1874): AH00294: Accept mutex: sysvsem (default: sysvsem)
[Wed Jun 13 21:45:20.907675 2018] [core:info] [pid 112123:tid 139709837686656] AH00096: removed PID file /usr/local/apache/logs/httpd.pid (pid=112123)
[Wed Jun 13 21:45:20.907684 2018] [mpm_worker:notice] [pid 112123:tid 139709837686656] AH00295: caught SIGTERM, shutting down
But if I start the service from /usr/local/apache/bin/apachectl -k start, the services are started properly and able to get the response.
[Wed Jun 13 21:46:25.146698 2018] [core:debug] [pid 112229:tid 140320724187008] log.c(1546): AH02639: Using SO_REUSEPORT: yes (1)
[Wed Jun 13 21:46:25.146711 2018] [mpm_worker:debug] [pid 112229:tid 140320724187008] worker.c(1874): AH00294: Accept mutex: sysvsem (default: sysvsem)
Is there any issue with my apphttpd.service script, any access issue ? Thanks for you suggestions and help in advance.

503 Error On Fedora 22 Server Using Apache 2.4 and Mono

I am currently attempting to setup a home webserver. I have a lot of experience programming in C# and have been using Visual Studio and IIS for years. I recently decided to make the move to Linux and have been rebuilding my code bases using MonoDevelop. I have them compiling on my development machine, so I am setting up a home server with Fedora 22 Server, and Apache 2.4.
Using nothing but the default configuration the server is able to serve html pages without a problem, but when I installed Mono, and its dependencies, I have been getting various errors, and they are not detailed enough for someone with my limited experience to resolve. I have spent the entire week working on the issue, and here is where I am stuck.
When browsing to http://71.41.214.194/LDC-Demo/index.aspx, I get a "503 Service Unavailable" error in the browser. When looking at the Apache Error log I get the following:
[Fri Oct 09 15:22:41.809588 2015] [:error] [pid 7577] Failed to connect to mod-mono-server after several attempts to spawn the process.
Since that is not enough to discern the issue, I restarted Apache and tried to reload the page (I was hoping for a related error that could help me chase down the problem)
[Fri Oct 09 15:38:22.000257 2015] [mpm_prefork:notice] [pid 7564] AH00170: caught SIGWINCH, shutting down gracefully
[Fri Oct 09 15:38:23.011225 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:23.011668 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:23.011770 2015] [:alert] [pid 7564] (13)Permission denied: Failed to acquire dashboard lock before destroying the dashboard
[Fri Oct 09 15:38:24.068911 2015] [core:notice] [pid 7641] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Fri Oct 09 15:38:24.069933 2015] [suexec:notice] [pid 7641] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globa$
[Fri Oct 09 15:38:24.079961 2015] [auth_digest:notice] [pid 7641] AH01757: generating secret for digest authentication ...
[Fri Oct 09 15:38:24.080817 2015] [lbmethod_heartbeat:notice] [pid 7641] AH02282: No slotmem from mod_heartmonitor
[Fri Oct 09 15:38:24.088966 2015] [mpm_prefork:notice] [pid 7641] AH00163: Apache/2.4.16 (Fedora) mod_mono/3.12 configured -- resuming normal operations
[Fri Oct 09 15:38:24.088993 2015] [core:notice] [pid 7641] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Fri Oct 09 15:38:36.414478 2015] [:error] [pid 7651] Failed to connect to mod-mono-server after several attempts to spawn the process.
After researching each of these messages to the best of my ability, I could not find anything that was related to the issue. I did find that I could see some more details if I ran the command "journalctl -xe -cat".
Started The Apache HTTP Server.
mono[7646]: segfault at 5 ip 0000000000512710 sp 00007fffa85f01b0 error 6 in mono-sgen[400000+34d000]
<audit-1130> pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=httpd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Unregistered Authentication Agent for unix-process:7633:25881589 (system bus name :1.83, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
<audit-1400> avc: denied { execmem } for pid=7649 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1400> avc: denied { execmem } for pid=7649 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1701> auid=4294967295 uid=48 gid=48 ses=4294967295 subj=system_u:system_r:httpd_t:s0 pid=7649 comm="mono" exe="/usr/bin/mono-sgen" sig=11
mono[7649]: segfault at 5 ip 0000000000512710 sp 00007ffe5ca30440 error 6 in mono-sgen[400000+34d000]
Not saving repeating crash in '/usr/bin/mono-sgen'
Not saving repeating crash in '/usr/bin/mono-sgen'
<audit-1400> avc: denied { sigchld } for pid=7647 comm="abrt-hook-ccpp" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=0
Failed to create core_backtrace: waitpid failed: Permission denied
Blacklisted package 'mono-core'
'post-create' on '/var/spool/abrt/ccpp-2015-10-09-15:38:24-7644' exited with 1
Deleting problem directory '/var/spool/abrt/ccpp-2015-10-09-15:38:24-7644'
<audit-1400> avc: denied { execmem } for pid=7661 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1400> avc: denied { execmem } for pid=7661 comm="mono" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:system_r:httpd_t:s0 tclass=process permissive=0
<audit-1701> auid=4294967295 uid=48 gid=48 ses=4294967295 subj=system_u:system_r:httpd_t:s0 pid=7661 comm="mono" exe="/usr/bin/mono-sgen" sig=11
mono[7661]: segfault at 5 ip 0000000000512710 sp 00007ffed5a32ee0 error 6 in mono-sgen[400000+34d000]
Not saving repeating crash in '/usr/bin/mono-sgen'
There is a lot more information in these messages, but I am still having a problem finding the cause. The last 5 lines are repeated three times.
I have tried making modifications to the apache config file (httpd.conf) as well as to the mod_mono.conf file, but nothing seems to get me past the problem.
In my current configuration the mod_mono.conf file is unmodified from the default configuration, and the only change that I have made to httpd.conf is to add a virtual host section as follows:
<VirtualHost *:80>
ServerName LDC-Demo
ServerAdmin root#localhost
ServerAlias LDC-Demo
DocumentRoot /var/www/html/LDC-Demo/
MonoServerPath LDC-Demo "/usr/bin/mod-mono-server4"
MonoDebug LDC-Demo true
MonoSetEnv LDC-Demo MONO_IOMAP=all
MonoApplications LDC-Demo "/:/var/www/html/LDC-Demo"
<Location "/LDC-Demo">
Allow from all
Order allow,deny
MonoSetServerAlias LDC-Demo
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
</VirtualHost>
Any ideas would be appreciated, as I stated above, I have been working on this all week, and am not making much progress.
I entered this above as a comment, but I intended to answer the question.
I figuered it out. Fedora runs SELinux, and it was interfering with the permissions needed for mod_mono to run. To see these settings I ran the command: getenforce Then to temporarily change the setting I used the following command: setenforce 0 Finally, restart Apache: apachectl restart I refreshed the web browser and the page loaded correctly. To make the setting permanant, edit the selinux file: nano /etc/sysconfig/selinux I rebooted the server, and tried to load the webpage again. Eureka! everything is working.

apache tomcat redirection error: worker1 connecting to backend failed

Getting the below logs when try to run servlet using apache tomcat integertaion. It says unable to connect to tomcat. Dont know why? Moreover, its trying to connect to 0.0.0.0:0 when I have
<Connector port="8009" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
Tried with
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
But no luch
[Sat May 19 13:29:39 2012] [5260:4324] [info] ajp_service::jk_ajp_common.c (2622): (worker1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Sat May 19 13:29:39 2012] [5260:4324] [debug] ajp_service::jk_ajp_common.c (2471): retry 1, sleeping for 100 ms before retrying
[Sat May 19 13:29:39 2012] [5260:4324] [debug] ajp_send_request::jk_ajp_common.c (1623): (worker1) all endpoints are disconnected.
[Sat May 19 13:29:39 2012] [5260:4324] [debug] jk_open_socket::jk_connect.c (485): socket TCP_NODELAY set to On
[Sat May 19 13:29:39 2012] [5260:4324] [debug] jk_open_socket::jk_connect.c (574): timeout 3000 set for socket=1548
[Sat May 19 13:29:39 2012] [5260:4324] [debug] jk_open_socket::jk_connect.c (609): trying to connect socket 1548 to 0.0.0.0:0
[Sat May 19 13:29:39 2012] [5260:4324] [info] jk_open_socket::jk_connect.c (627): connect to 0.0.0.0:0 failed (errno=47)
[Sat May 19 13:29:39 2012] [5260:4324] [info] ajp_connect_to_endpoint::jk_ajp_common.c (995): Failed opening socket to (0.0.0.0:0) (errno=47)
[Sat May 19 13:29:39 2012] [5260:4324] [error] ajp_send_request::jk_ajp_common.c (1629): (worker1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=47)
[Sat May 19 13:29:39 2012] [5260:4324] [info] ajp_service::jk_ajp_common.c (2622): (worker1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Sat May 19 13:29:39 2012] [5260:4324] [error] ajp_service::jk_ajp_common.c (2642): (worker1) connecting to tomcat failed.
[Sat May 19 13:29:39 2012] [5260:4324] [debug] ajp_reset_endpoint::jk_ajp_common.c (786): (worker1) resetting endpoint with socket -1 (socket shutdown)
[Sat May 19 13:29:39 2012] [5260:4324] [debug] ajp_done::jk_ajp_common.c (3085): recycling connection pool for worker worker1 and socket -1
[Sat May 19 13:29:39 2012] [5260:4324] [info] jk_handler::mod_jk.c (2788): Service error=-3 for worker=worker1
[Sat May 19 13:29:47 2012] [5260:4324] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/LoginApp' from 3 maps
[Sat May 19 13:29:47 2012] [5260:4324] [debug] find_match::jk_uri_worker_map.c (945): Attempting to map context URI '/automationutil/*=worker1' source 'JkMount'
[Sat May 19 13:29:47 2012] [5260:4324] [debug] find_match::jk_uri_worker_map.c (958): Found a wildchar match '/automationutil/*=worker1'
[Sat May 19 13:29:47 2012] [5260:4324] [debug] jk_handler::mod_jk.c (2621): Into handler jakarta-servlet worker=worker1 r->proxyreq=0
[Sat May 19 13:29:47 2012] [5260:4324] [debug] wc_get_worker_for_name::jk_worker.c (115): found a worker worker1
[Sat May 19 13:29:47 2012] [5260:4324] [debug] wc_get_name_for_type::jk_worker.c (292): Found worker type 'ajp13'
[Sat May 19 13:29:47 2012] [5260:4324] [debug] init_ws_service::mod_jk.c (1097): Service protocol=HTTP/1.1 method=POST ssl=false host=(null) addr=127.0.0.1 name=localhost port=82 auth=(null) user=(null) laddr=127.0.0.1 raddr=127.0.0.1 uri=/automationutil/LoginApp
[Sat May 19 13:29:47 2012] [5260:4324] [debug] ajp_get_endpoint::jk_ajp_common.c (3154): acquired connection pool slot=0 after 0 retries
[Sat May 19 13:29:47 2012] [5260:4324] [debug] ajp_marshal_into_msgb::jk_ajp_common.c (626): ajp marshaling done
[Sat May 19 13:29:47 2012] [5260:4324] [debug] ajp_service::jk_ajp_common.c (2449): processing worker1 with 2 retries
[Sat May 19 13:29:47 2012] [5260:4324] [debug] ajp_send_request::jk_ajp_common.c (1623): (worker1) all endpoints are disconnected.
[Sat May 19 13:29:47 2012] [5260:4324] [debug] jk_open_socket::jk_connect.c (485): socket TCP_NODELAY set to On
[Sat May 19 13:29:47 2012] [5260:4324] [debug] jk_open_socket::jk_connect.c (574): timeout 3000 set for socket=1548
[Sat May 19 13:29:47 2012] [5260:4324] [debug] jk_open_socket::jk_connect.c (609): trying to connect socket 1548 to 0.0.0.0:0
[Sat May 19 13:29:47 2012] [5260:4324] [info] jk_open_socket::jk_connect.c (627): connect to 0.0.0.0:0 failed (errno=47)
[Sat May 19 13:29:47 2012] [5260:4324] [info] ajp_connect_to_endpoint::jk_ajp_common.c (995): Failed opening socket to (0.0.0.0:0) (errno=47)
[Sat May 19 13:29:47 2012] [5260:4324] [error] ajp_send_request::jk_ajp_common.c (1629): (worker1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=47)
[Sat May 19 13:29:47 2012] [5260:4324] [info] ajp_service::jk_ajp_common.c (2622): (worker1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Sat May 19 13:29:47 2012] [5260:4324] [debug] ajp_service::jk_ajp_common.c (2471): retry 1, sleeping for 100 ms before retrying
[Sat May 19 13:29:47 2012] [5260:4324] [debug] ajp_send_request::jk_ajp_common.c (1623): (worker1) all endpoints are disconnected.
[Sat May 19 13:29:47 2012] [5260:4324] [debug] jk_open_socket::jk_connect.c (485): socket TCP_NODELAY set to On
[Sat May 19 13:29:47 2012] [5260:4324] [debug] jk_open_socket::jk_connect.c (574): timeout 3000 set for socket=1548
[Sat May 19 13:29:47 2012] [5260:4324] [debug] jk_open_socket::jk_connect.c (609): trying to connect socket 1548 to 0.0.0.0:0
[Sat May 19 13:29:47 2012] [5260:4324] [info] jk_open_socket::jk_connect.c (627): connect to 0.0.0.0:0 failed (errno=47)
[Sat May 19 13:29:47 2012] [5260:4324] [info] ajp_connect_to_endpoint::jk_ajp_common.c (995): Failed opening socket to (0.0.0.0:0) (errno=47)
[Sat May 19 13:29:47 2012] [5260:4324] [error] ajp_send_request::jk_ajp_common.c (1629): (worker1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=47)
[Sat May 19 13:29:47 2012] [5260:4324] [info] ajp_service::jk_ajp_common.c (2622): (worker1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Sat May 19 13:29:47 2012] [5260:4324] [error] ajp_service::jk_ajp_common.c (2642): (worker1) connecting to tomcat failed.
[Sat May 19 13:29:47 2012] [5260:4324] [debug] ajp_reset_endpoint::jk_ajp_common.c (786): (worker1) resetting endpoint with socket -1 (socket shutdown)
[Sat May 19 13:29:47 2012] [5260:4324] [debug] ajp_done::jk_ajp_common.c (3085): recycling connection pool for worker worker1 and socket -1
[Sat May 19 13:29:47 2012] [5260:4324] [debug] jk_handler::mod_jk.c (2719): Consumed 22 bytes of remaining request data for worker=worker1
[Sat May 19 13:29:47 2012] [5260:4324] [info] jk_handler::mod_jk.c (2788): Service error=-3 for worker=worker1
Any help is highly appreciated. Banging my head for last 10 days.
mod_jk.conf (C:\Program Files\apache-tomcat-5.5.35\conf\auto)
########## Auto generated on Sat May 19 12:48:58 IST 2012##########
<IfModule !mod_jk.c>
LoadModule jk_module "modules/mod_jk.dll"
</IfModule>
<VirtualHost localhost>
ServerName localhost
JkMount /webdav ajp13
JkMount /webdav/* ajp13
JkMount /tomcat-docs ajp13
JkMount /tomcat-docs/* ajp13
JkMount /balancer ajp13
JkMount /balancer/* ajp13
JkMount /host-manager ajp13
JkMount /host-manager/* ajp13
JkMount /automationutil ajp13
JkMount /automationutil/* ajp13
JkMount /servlets-examples ajp13
JkMount /servlets-examples/* ajp13
JkMount /jsp-examples ajp13
JkMount /jsp-examples/* ajp13
JkMount /manager ajp13
JkMount /manager/* ajp13
</VirtualHost>
workers.properties
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
#worker.worker1.lbfactor=50
#worker.worker1.cachesize=10
#worker.worker1.cache_timeout=600
#worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=3000
uriworkermap.properties
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# uriworkermap.properties - IIS
#
# This file provides sample mappings for example wlb
# worker defined in workermap.properties.minimal
# The general syntax for this file is:
# [URL]=[Worker name]
#/admin/*=lb
#/manager/*=lb
#/jsp-examples/*=lb
/servlets-examples/*=worker1
#/examples/*=lb
/automationutil=worker1
/automationutil/*=worker1
#!/automationutil/*.html=worker1
# Optionally filter out all .jpeg files inside that context
# For no mapping the url has to start with exclamation (!)
#!/servlets-examples/*.jpeg=lb
#
# Mount jkstatus to /jkmanager
# For production servers you will need to
# secure the access to the /jkmanager url
#
#/jk-manager=jk-status
httpd.conf
#Include "C:/Program Files/Apache Software Foundation/Apache2.2/conf/vhosts.conf"
#LoadModule jk_module "C:/Program Files/Apache Software Foundation/Apache2.2/modules/mod_jk.so"
# Load mod_jk module
# Update this path to match your modules location
LoadModule jk_module "C:/Program Files/Apache Software Foundation/Apache2.2/modules/mod_jk.so"
# Declare the module for <IfModule directive> (remove this line on Apache 2.x)
#AddModule mod_jk.c
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/workers.properties"
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile "C:/Program Files/Apache Software Foundation/Apache2.2/logs/mod_jk.shm"
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile "C:/Program Files/Apache Software Foundation/Apache2.2/logs/mod_jk.log"
# Set the jk log level [debug/error/info]
#JkLogLevel info
JkLogLevel debug
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Send everything for context /examples to worker named worker1 (ajp13)
#<VirtualHost localhost:80>
# Set DocumentRoot equal to Tomcat ROOT context
#DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
#DocumentRoot "C:/Program Files/apache-tomcat-5.5.35/webapps"
# Exclude PHP & CGI (let Apache handle)
SetEnvIf Request_URI \.php no-jk
#SetEnvIf Request_URI \.cgi no-jk
#JkMount /* worker1
JkMount /automationutil worker1
JkMount /automationutil/* worker1
JkUnMount /automationutil/*.html worker1
#JkMount /automationutil/* worker1
#</VirtualHost>
I had a similar problem and I fixed it by using the previous version of mod_jk. I originally downloaded version 1.2.36 but I was able to get it to work using 1.2.35. You can download the previous versions here: http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/

Glassfish 3.1.2 Apache2 loadbalancing with mod_jk

We are using glassfish 3.1.2 which is loadbalanced by Apache with mod_jk however, when I turn on the ping_mode to C or A it does not work, it just says
[Wed May 09 08:17:05 2012] [15033:140400029296384] [info] ajp_handle_cping_cpong::jk_ajp_common.c (889): awaited reply cpong, not received
[Wed May 09 08:17:05 2012] [15033:140400029296384] [error] ajp_connect_to_endpoint::jk_ajp_common.c (992): (worker2) cping/cpong after connecting to the backend server failed (errno=0)
[Wed May 09 08:17:05 2012] [15033:140400029296384] [error] ajp_send_request::jk_ajp_common.c (1585): (worker2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=0)
[Wed May 09 08:17:05 2012] [15033:140400029296384] [info] ajp_service::jk_ajp_common.c (2540): (worker2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=19)
[Wed May 09 08:17:06 2012] [15033:140400029296384] [info] ajp_connection_tcp_get_message::jk_ajp_common.c (1223): (worker2) can't receive the response header message from tomcat, tomcat (192.168.42.83:8009) has forced a connection close for socket 15
However, if I comment out the following line it works fine, any ideas?
worker.template.ping_mode=A
My entire workers file looks like this.
worker.list=loadbalancer, status
worker.template.type=ajp13
worker.template.port=8009
worker.template.lbfactor=1
worker.template.socket_timeout=10
worker.template.ping_timeout=10000
worker.template.ping_mode=A
worker.template.connection_pool_size=25
worker.template.connection_pool_timeout=300
worker.template.retries=20
worker.worker1.reference=worker.template
worker.worker1.host=node1
worker.worker2.reference=worker.template
worker.worker2.host=node2
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=worker1,worker2
worker.status.type=status