View System Documentation - Handling System Errors
This page describes how the system handles errors. Listed below are the types of system errors:
HTTP ErrorsHTTP errors occur when a user requests a resource (via a URL) that is not mapped to the system (via the servlet mapping contained within the web.xml) and that file/resource is not found or has access issues etc (If not mapped then the app server treats the request as a normal web server would). HTTP errors can also occur in the MVC portion of the application for mapped resources but these are typically set by the Exception handler or if an uncaught Java runtime error occurs. The Java application server deals with these types of errors via the handlers defined within the app's "WEB-INF/web.xml" file (all standard HTML errors 404...500 - see table below). These typically are mapped to the "jsp/ErrorPage.jsp" page to be displayed to the user.
Caught MVC Java ExceptionsJava exceptions can be thrown within the any portion of the MVC pattern. This includes catchable view errors like XML file not found errors, most null pointers, and all throws that are controller and model related. Most view rendering related errors are able to be caught (see next item).
The Exception class is used to catch and display exceptions thrown by the application. Logging also shows all exceptions thrown. See the WEB-INF/config/spring/common.xml" which contains a bean id="Default.ExceptionHandler" that specifies the exception error handler class to be used; typically class="org.ibisph.mvc.ExceptionHandler". When errors like this occur, they are typically logged and displayed to the via the "jsp/ErrorPage.jsp" page.
Caught "View Rendering" ExceptionsThis type of error is typically when an XSLT has a problem. The error is caught by the view object but since the user's response stream has already been opened the Spring MVC RequestDispatcher servlet can not do anything about displaying an error page. The user is typically shown a blank page but the exception is logged in the various log files.
Uncaught Java Runtime ErrorsHopefully these rarely happen. Java runtime errors are unexpected and not caught by the Spring MVC RequestDispatcher servlet or the MVC code. This type of problem is seen when a system object is null or if the the system runs out of memory etc). Errors like this typically do not show the user anything other than a blank screen. Most of the time, unless the JVM crashes, the error will show up in the output logs.
HTTP Errors Defined in WEB-INF/web.xml
|401||Unauthorized requested resource|
|403||Forbidden resource - refused|
|404||Resource not found|
|405||Unsupported method for this URL|
|406||The requested resource exists, but not in a format/type that your browser will accept.|
|407||The proxy server needs authorization before it can proceed.|
|408||Request timed out. The resource is in use or is temporarily unavailable or there is a network problem.|
|414||The requested URI (URL) is too long for the server to handle.|
|415||The server can not process the request because the request body is in an unsupported media format.|
|500||An unexpected error occurred inside the server that prevented it from fulfilling the request.|
|501||Requested function is not implemented by this application on this server.|
|502||Bad internet gateway. A server acting as a gateway or proxy did not receive a valid response from an upstream server.|
|503||The service (server) is temporarily unavailable but should be restored in the future.|
|504||A gateway timeout error has occurred. A server acting as a gateway or proxy did not receive a valid response in time.|
|505||The server does not support the version of the HTTP protocol used in the request.|
|java.lang.Throwable||Uncaught System Run Time Exception|