Apache mod_jk Setting for Tomcat - workers.properties

Posted by sissonb on Server Fault See other posts from Server Fault or by sissonb
Published on 2012-03-28T17:32:12Z Indexed on 2012/03/28 23:34 UTC
Read the original article Hit count: 496

Filed under:
|
|

I am trying to direct files with .jsp extensions to tomcat. Otherwise I want apache to serve the file directly (no tomcat). Currently I have a test.jsp which is supposed to create an HTML page with the current date in the body. Instead when I go to that .jsp I see the JK Status Manager. The mod_jk.logs only show, init_jk::mod_jk.c (3365): mod_jk/1.2.35 initialized.

I have tomcat and apache setup on my server. Apache runs on 80 and tomcat runs on 8080. localhost:8080 show the tomcat welcome page. I downloaded tomcat-connectors-1.2.35-windows-i386-httpd-2.2.x and copied the mod_jk.so to C:\apache\modules.

Then I added LoadModule jk_module modules/mod_jk.so to my httpd.conf. I restart apache and the module loads just fine.

Next I downloaded the mod_jk source to get the workers.properties file. I copy workers.properties to C:\apache\confg. Then I added this user,

workers.tomcat_home="C:/Program Files/Apache Software Foundation/Tomcat 7.0"
workers.java_home="C:/Program Files/Java/jdk1.7.0_03"

worker.list=ajp13
worker.ajp13.port=8080
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.socket_timeout=10

When I try to use the ajp13 user in my httpd.conf I get the following error in my mod_jk.log,

[Wed Mar 28 13:08:51 2012] [2196:4100] [info] ajp_connection_tcp_get_message::jk_ajp_common.c (1258): (ajp13) can't receive the response header message from tomcat, network problems or tomcat (127.0.0.1:8080) is down (errno=60)
[Wed Mar 28 13:08:51 2012] [2196:4100] [error] ajp_get_reply::jk_ajp_common.c (2117): (ajp13) Tomcat is down or refused connection. No response has been sent to the client (yet)
[Wed Mar 28 13:08:51 2012] [2196:4100] [info] ajp_service::jk_ajp_common.c (2614): (ajp13) sending request to tomcat failed (recoverable),  (attempt=1)

Next I update my httpd.conf with,

JkWorkersFile C:/apache/conf/workers.properties
JkLogFile C:/apache/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

Also I added JkMount /*.jsp jk-status to my virtual host like this,

<VirtualHost 192.168.5.250:80>
   JkMount /*.jsp jk-status
   #JkMount /*.jsp ajp13
   ServerName bgsisson.com
   ServerAlias www.bgsisson.com
   DocumentRoot C:/www/resume
</VirtualHost>

I think i need to include a uriworkermap.properties file, but this is where I am getting stuck.

I have put up a test .jsp at bgsisson.com/test.jsp It shows the JK Status Manager when I use JkMount /*.jsp jk-status and 502 Bad Gateway when I use JkMount /*.jsp ajp13

test.jsp

<%-- use the 'taglib' directive to make the JSTL 1.0 core tags available; use the uri
"http://java.sun.com/jsp/jstl/core" for JSTL 1.1 --%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

<%-- use the 'jsp:useBean' standard action to create the Date object;  the object is set
as an attribute in page scope
--%>
<jsp:useBean id="date" class="java.util.Date" />

<html>
<head><title>First JSP</title></head>
<body>
<h2>Here is today's date</h2>

<c:out value="${date}" />

</body>
</html>

© Server Fault or respective owner

Related posts about apache2

Related posts about mod-jk