Debugging Custom Error Pages in Tomcat
Date: 11-Jan-2007
Your Page Doesn't Come Up
Test against a known 404 resource such as blahblahblah.png. If the page doesn't come up, try browsing to the error page directly. If the error page has a compile error (maybe others???), it will go to the default TC error page e.g. the standard 404. Browsing to the page directly circumvents this and lets you see the real error.
If you are generating 404 errors, say from a CMS or servlet, make sure that you call response.sendError and not setStatus, since setStatus will not do the redirect, even if you use an error status code.
Tomcat 4 vs 5+
Tomcat 4.4 is picky regarding web.xml ordering, so a badly ordered web.xml that works in TC5.5 may fail in TC4.1. The error will look like:
<insert error here>
Also, ErrorData is not supported on 4.1. The fix is TBA.