On 3/30/07, Will Glass-Husain <[EMAIL PROTECTED]> wrote:
I just concluded a frustrating debugging session in which a servlet was throwing a ServletException in the init method.
How do you know that the Servlet was throwing an Exception in the init method ?
No error messages in any log file. (tomcat\logs\*) The localhost log file was empty. There was some various items in the stdout and the catalina log file. None mentioned the problematic servlet.
Is the web.xml present for this project? Does the web.xml have the Servlet name and URL pattern defined? I temporarily disabled web.xml and tried to access the Servlet -- it gave a 404 error and nothing else was logged in catalina out or the console (this is expected behavior). Anyway, I tried a small test, and I was able to see an Exception message both on the web page for this Servlet and in catalina log file. package test61; import javax.servlet.*; public class TestServlet extends HttpServlet { public void init(ServletConfig config) throws ServletException { try { int test = 5; int divideByZeroError = test / 0; } catch (Exception e) { throw new ServletException("Divide By Zero Exception in init method: ", e); } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { doPost(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException { //nothing } } The above was tested on Tomcat 6.0.x ZIP install (not Windows Service) on Windows XP , with full JDK (not JRE) -Rashmi --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]