This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
The basics... Apache 1.3x coupled to Tomcat 4.1 using mod_jk. Apache's httpd.conf is set up to send *.jsp and /servlet/* to tomcat. Tomcat has the context path set to "" (the default) and the doc path set to "public_html (WEB-INF is under public_html). Servlets are mapped "/servlet/servletname" Jsp's work fine, and so do simple servlets (both mapped, and using the invoker statement).
My problem is when I try to use a RequestDispatcher (both ServletContext, and HttpRequest). I've managed to track it down to the fact that Tomcat is returning null when I getServletContext(). It's not the code because it works on Resin.
My guess is it's either a Context path issue in server.xml, and/or a servlet mapping problem. I've tried setting the context path to "/" and that gives me a 500 error on tomcat. I've tried moving the webapp to a different dir and setting a new context path and that gives me a 404 error (using both mapping and invoker).
Anyone have any clues what's up?
Joined: May 20, 2002
After much hair pulling, I managed to solve the problem, but I have no idea why... Maybe someone can explain it to me....
On both Tomcat 4.0 and Resin, getServletContext() gave me a servlet context. On Tomcat 4.1, I had to use getServletConfig().getServletContext().
Anyone ever hear of this before, or have any ideas?