apache tomcat redirection error: worker1 connecting to backend failed

anujin picture anujin · May 19, 2012 · Viewed 21.6k times · Source

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>

Answer

Terrence Truta picture Terrence Truta · May 23, 2012

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/