Tomcat refuses to redirect to my custom error pages
843840Jun 14 2010 — edited Jun 16 2010Hi!
I'll just go right on... I've made a servlet that is supposed to catch all of my possible HTTP errors that my application may encounter. It is mapped in the web.xml properly, and is accessed like this: /myWebApp/error/. In web.xml I've mapped my 404 errors to /errors/404, and the error catcher servlet works as expected.
The problem occurs when I am sending other HTTP errors with the HttpServletResponse.sendError() method. If I do not define any custom error pages, it works just fine, and Tomcat displays its standard HTTP error page for that specific error, but when I map the error to my error catcher, the web-browser just stays pale white, and when I inspected the HTTP header, I got to know that Tomcat actually sent a HTTP405 - Method not allowed.
Anybody know how come it works for 404-pages but not any other? I've been debugging this for some time now, but I think I need help from you guys to solve this. I am running Tomcat 6, and develops with Eclipse. (Windows 7).
Thanks in advance.
/Chris