Connecting tomcat6 to apache2

Posted by StudentKen on Server Fault See other posts from Server Fault or by StudentKen
Published on 2011-02-14T00:58:19Z Indexed on 2011/02/16 7:26 UTC
Read the original article Hit count: 429

Filed under:
|
|

Disclaimier: Not a server admin

I've been scratching my head over this for weeks now (not consistently mind you, as that would be maddening). I've been trying to connect my apache2 server to my tomcat server to the point where if someone encounters *.jsp or any servelet in navigating my web directory, it's handed over to tomcat.

I have both Apache2.0 (port 9099) and Tomcat6 (9089) running on Debian lenny on the same box.

Currently, mod_jk is enabled with mod_jk.conf in $apacheHOME/mods-enabled/ with content:

    # Where to find workers.properties
JkWorkersFile /etc/apache2/workers.properties
    # Where to put jk shared memory
JkShmFile     /var/log/at_jk/mod_jk.shm
    # Where to put jk logs
JkLogFile     /var/log/at_jk/mod_jk.log
    # Set the jk log level [debug/error/info]
JkLogLevel    info
    # Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
    # Send servlet for context /examples to worker named worker1
JkMount  /*/servlet/* worker1
    # Send JSPs  for context /examples to worker named worker1
JkMount  /*.jsp worker1

my workers.properties located in $apacheHOME/ with content:

workers.tomcat_home=/var/lib/tomcat6
workers.java_home=/usr/lib/jdk1.6.0_23/db/
worker.list=worker1
ps=/

worker.worker1.port=9071
worker.worker1.host=localhost
worker.worker1.type=ajp13

my web.xml in $tomcatHOME/conf has the following servlets enabled

<servlet>
    <servlet-name>default</servlet-name>
    <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-cla$
    <init-param>
        <param-name>debug</param-name>
        <param-value>0</param-value>
    </init-param>
    <init-param>
        <param-name>listings</param-name>
        <param-value>false</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>


<servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
        <param-name>fork</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>xpoweredBy</param-name>
        <param-value>false</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
</servlet-mapping>

<session-config>
    <session-timeout>30</session-timeout>
</session-config>

From what I can tell, there's no funny buisness as both the apache2, tomcat, and mod_jk logs show green; yet whenever I navigate to a jsp, it simply displays the javascript.

I'm unsure what the problem is exactly despite pouring over the logs and documentation for aid. I'm quite a greenhorn in the servelet world.

© Server Fault or respective owner

Related posts about apache2

Related posts about tomcat6