How to get the exception stacktrace with Tomcat 4.1.x

Hello,

A difference between Tomcat 3.x and Tomcat 4.1.18 is the stacktrace that is returned if an exception occurs. If you do not define an error page, Tomcat 3.x returns the stacktrace of the original exception that caused the problem. Tomcat 4.x catches and wraps the original exception and returns the stacktrace of the wrapped exception.

This makes it difficult to give support because the wrapped exception does not contain the detailed information where the error occurred.

Therefore, the following propose:

When working with Tomcat 4.1.18 and running into a problem with exception, add the error page posted by this mail to your JSP page.

How to include an error page?

Add the attribute errorPage to your page declaration, e.g.

<%@ page language="java" contentType="text/html; charset=UTF-8" errorPage="error.jsp"%>


The file error.jsp itself contains Java code to return the stacktrace of the exception as plain text.

Bye,
Christian.
error.jsp (451 Bytes)