Servlets and Tomcat/Apache
843835Feb 4 2003 — edited May 10 2005Okay,
Tomcat 4.1 running with Apache.
Installed mod_jk, piece of cake.
JSPs run through Apache like a dream.
Tomcat examples ( jsp and servlets) run through Apache perfectly ( that is no :8080 business).
My JSP's run through Apache no problem. Works great.
My SERVLETS WILL NOT RUN THROUGH APACHE FOR ANYTHING.
My context looks like this in server.xml:
<Context path="/nuweb" docBase="/home/shared/nuweb" debug="0"
reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="nuweb" suffix=".log"
timestamp="true"/>
</Context>
Note: that I am not under <TOMCAT_HOME>/webapps.
The reason is that I will, in production not be the Unix admin on the server. I will only have priviledges within my directory. I will not be able to drop war files in the webapps directory. I will not be able
to start and stop tomcat or apache ( there are 100 diffrent apache contexts on that machine and someday many of them will be going through tomcat for jsp and servlet support).
My servlets will only run if I put :8080/nuweb/servlet/HelloServlet in the URL. Take off the 8080 and I get Page not found. Not the tomcat 404 page, the Browswer 404 errror.
Here is my web.xml which lives in the WEB-INF directory of of /home/shared/nuweb
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<servlet-class>org.nu.servlet.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>
In devlopment I am on a system that is very close to what the production server will look like ( Tomcat 4.1 same version of Apache, same Unix ). In development I can restart all the servers edit server.xml etc. On the production I would have to schedule that stuff. I want to be able to compile classes and drop them in the WEB-INF/classes... directory and have them run. Is that too much to ask?