Configuring Apache in front of Jboss as load balancer
<p>I have my web application deployed in JBoss AS 7.1. After writing middleware code in Java, when I started writing user interface. I thought of using Apache httpd for accessing static resources like css, js and html. Hence I installed httpd 2.4.23 and made configuration changes to access the directory in which I have my static resources. Then I wanted to use httpd as load balancer. For that I installed mod_jk 1.2.41. I created workers.property with following details:</p>

<pre><code># for mapping requests 
# The configuration directives are valid 
# for the mod_jk version 1.2.18 and later 
worker.list=loadbalancer,status 
# Define node 
# modify the host as your host IP or DNS name. 
worker.node.port=8009
worker.node.host=127.0.0.1 
#(IP or DNS name of the server on which Jboss is running) 
worker.node.type=ajp13 
worker.node.lbfactor=1 
# Load-balancing behaviour 
worker.loadbalancer.type=lb 
worker.loadbalancer.balance_workers=node 
worker.loadbalancer.sticky_session=1 
worker.status.type=status
</code></pre>

<p>Here is my mod-jk.conf</p>

<pre><code>LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkShmFile logs/mod_jk.shm
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /sb/* loadbalancer
JkMount /sb.web/* loadbalancer
</code></pre>

<p>I added this configuration file at the end of httpd.conf:</p>

<pre><code>Include C:/Apache24/conf/mod-jk.conf
</code></pre>

<p>I checked my JBoss configuration refering following:</p>

<p><a href="https://docs.jboss.org/author/display/AS71/Using+mod_jk+with+JBoss+AS7#Usingmod_jkwithJBossAS7-Compile%26InstallApacheHttpd" rel="nofollow">https://docs.jboss.org/author/display/AS71/Using+mod_jk+with+JBoss+AS7#Usingmod_jkwithJBossAS7-Compile%26InstallApacheHttpd</a></p>

<p>I am not able to acccess my JBoss application using httpd URL. It gives following error log:</p>

<pre><code>::1 - - [01/Aug/2016:01:26:58 +0530] "GET /sb/v1/sc/m/2/ HTTP/1.1" 503 299
</code></pre>

<p>mod-jk logs:</p>

<pre><code> [7132:1928] [info] jk_open_socket::jk_connect.c (817): connect to 127.0.0.1:8009 failed (errno=61)
 [7132:1928] [info] ajp_connect_to_endpoint::jk_ajp_common.c (1068): (node) Failed opening socket to (127.0.0.1:8009) (errno=61)
 [7132:1928] [error] ajp_send_request::jk_ajp_common.c (1728): (node) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=61)
 [7132:1928] [info] ajp_service::jk_ajp_common.c (2773): (node) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
 [7132:1928] [error] ajp_service::jk_ajp_common.c (2794): (node) connecting to tomcat failed (rc=-3, errors=4, client_errors=0).
 [7132:1928] [info] service::jk_lb_worker.c (1595): service failed, worker node is in error state
 [7132:1928] [info] service::jk_lb_worker.c (1675): All tomcat instances are busy or in error state
 [7132:1928] [error] service::jk_lb_worker.c (1680): All tomcat instances failed, no more workers left
 [7132:1928] [info] jk_handler::mod_jk.c (2991): Service error=0 for worker=loadbalancer
</code></pre>

<p>I am able to access JBoss application by its own URL and can access static content using httpd URL means both of these servers are running perfectly.
Please help.</p>