Jump to: navigation, search

ErrorServlet handles Http server error codes (e.g. 404 = file not found), and unexpected internal Java exceptions and shows a corresponding message to the user.

There are several conditions which must be met by the web application:

  • The servlet and all methods called therein must not catch any exceptions themselves, but must - possibly after logging - throw them to the caller. In the end, that will be the container (Tomcat) or application server (WebSphere), which activates the ErrorServlet.
  • The configuration file WEB-INF/web.xml should contain an element for at least the Servlet 3.0 specification (December 2009), which is implemented by Tomcat Version 7 and above.
<web-app xmlns=""
  • web.xml must contain proper references to the ErrorServlet: