Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Tomcat refuses to redirect to my custom error pages

843840Jun 14 2010 — edited Jun 16 2010
Hi!

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 14 2010
Added on Jun 14 2010
5 comments
2,917 views