I'm posting this after checking out several other posts that seem to have the same issue but I can't solve my problem with the help of any of these.
Situation: -I am using Windows 8 Professional -I installed 3 tomcat instances on my localhost -I installed Apache 2.4 with mod_jk to be used as my loadbalancer
What I'm trying to achieve is: -Goto localhost/APPNAME (which is the Apache 2.4), Apache will now redirect my call to one of the 3 Tomcat 7 instances and give me the requested page.
This is the first time I'm doing this so probably I'm forgetting something somewhere. What I have now is this:
The Tomcat 7 server.xml's look like this:
1st Tomcat has:
<Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">
2nd Tomcat has:
<Connector port="8082" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8444" />
<Connector port="8010" protocol="AJP/1.3" redirectPort="8444" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">
3rd Tomcat has:
<Connector port="8083" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8445" />
<Connector port="8011" protocol="AJP/1.3" redirectPort="8445" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat3">
For the Apache server I added to the httpd.conf: LoadModule jk_module modules/mod_jk.so
<IfModule jk_module>
Include conf/extra/mod_jk.conf
</IfModule>
The mod_jk.conf looks like this:
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkShmFile logs/jk-runtime-status
JkLogStampFormat "[%b %d %Y - %H:%M:%S] "
JkRequestLogFormat "%w %V %T"
JkMountCopy All
JkMount /* balancer
#JkMount /* tomcat1
#JkMount /* tomcat2
#JkMount /* tomcat3
And finally my workers.properties file looks like this:
worker.tomcat1.type=ajp13
worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.lbfactor=1
worker.tomcat2.type=ajp13
worker.tomcat2.port=8010
worker.tomcat2.host=localhost
worker.tomcat2.lbfactor=1
worker.tomcat3.type=ajp13
worker.tomcat3.port=8011
worker.tomcat3.host=localhost
worker.tomcat3.lbfactor=1
#configure the loadbalancer
worker.balancer.type=lb
worker.balancer.balance_workers=tomcat1,tomcat2,tomcat3
worker.balancer.method=B
worker.balancer.sticky_session=True
worker.stat.type=status
Now I have started all mu tomcat instances first, then I start my Apache. It will now give me the following message in the mod_jk.log:
[Dec 12 2014 - 12:23:58] [3180:8452] [info] init_jk::mod_jk.c (3383): mod_jk/1.2.40 initialized
[Dec 12 2014 - 12:23:58] [3180:8452] [error] extension_fix::jk_uri_worker_map.c (578): Could not find worker with name 'balancer' in uri map post processing.
[Dec 12 2014 - 12:23:58] [3180:8452] [info] init_jk::mod_jk.c (3383): mod_jk/1.2.40 initialized
[Dec 12 2014 - 12:23:58] [3180:8452] [error] extension_fix::jk_uri_worker_map.c (578): Could not find worker with name 'balancer' in uri map post processing.
[Dec 12 2014 - 12:23:58] [9912:8284] [info] init_jk::mod_jk.c (3383): mod_jk/1.2.40 initialized
[Dec 12 2014 - 12:23:58] [9912:8284] [error] extension_fix::jk_uri_worker_map.c (578): Could not find worker with name 'balancer' in uri map post processing.
[Dec 12 2014 - 12:23:59] [9912:8284] [info] init_jk::mod_jk.c (3383): mod_jk/1.2.40 initialized
[Dec 12 2014 - 12:23:59] [9912:8284] [error] extension_fix::jk_uri_worker_map.c (578): Could not find worker with name 'balancer' in uri map post processing.
Which of course means that I doesn't work. Can anyone please help me and give me an idea what I'm doing wrong?
Okay, I got it to work. It seems that I used an Apache Server which causes the problem.
I was searching a bit more and more specific on this forum and found this post: httpd AND Tomcat with mod_jk on Port 80 test fails
Thanks to this answer I decided to try a different Apache download too.
From the Apache site I used download to the Apache Haus version of Apache for Windows. I could not get it to work. However, I downloaded another version from the website, copied all my settings, and now it works!