Question

Newbie to this technology hence pls be gentle. Aim is to setup Tomcat load-balancing with mod_jk. My setup is below (all on one machine):

Win7 x64 Apache Httpd 2.2 Tomcat 6 mod_jk 1.2.37 (for httpd2.2.x) 2 Tomcat instances (same machine)

I've setup Tomcat correctly and can access the webapps via localhost:8080 and localhost:8081. But when I try to access the webapps via Httpd (localhost/dept1 or localhost/dept2), I get "404 Not Found " The requested URL /dept1 was not found on this server. Httpd works when accessed by URL, http: //localhost "It works!"

The only lines added to httpd.conf (Apache2.2) are:

LoadModule jk_module modules/mod_jk.so
JkWorkersFile C:/ApacheHTTPD/conf/workers.properties
JkLogFile C:/ApacheHTTPD/logs/mod_jk.log
JkLogLevel emerg
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat +ForwardDirectories
JkRequestLogFormat "%w %V %T %p %q %r %v %U"
JkMount /%CATALINA_HOME%/webapps/dept1/* tomcatbase
JkMount /%CATALINA_HOME2%/webapps/dept2/* tomcat1

workers.properties file contains:

worker.list=tomcatbase,tomcat1
worker.tomcatbase.type=ajp13
worker.tomcatbase.host=localhost
worker.tomcatbase.port=8009
worker.tomcat1.type=ajp13
worker.tomcat1.host=localhost
worker.tomcat1.port=8010

All other setup is (Apache and the 2 Tomcat instances) are default. Now, http:// localhost:8080/dept1 works. So is it that the redirect from Apache to Tomcat isn't working?

Thanks in advance Bharath

Was it helpful?

Solution

Try this:

JkMount /dept1/* tomcatbase
JkMount /dept2/* tomcat1

The first parameter of the JkMount directive is a URL prefix, not a local path.

JkMount [URL prefix] [Worker name]

Please see http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top