Name
ServletException
Synopsis
Class Name:
javax.servlet.ServletException
Superclass: java.lang.Exception
Immediate Subclasses:
javax.servlet.UnavailableException
Interfaces Implemented: None
Availability: Servlet API 1.0 and later
Description
A generic exception thrown by servlets encountering difficulties.
Class Summary
public class ServletException extends java.lang.Exception {
// Constructors
public ServletException(); // New in 2.0
public ServletException(String msg);
public ServletException(String msg, Throwable rootCause); // New in 2.1
public ServletException(Throwable rootCause); // New in 2.1
public Throwable getRootCause(); // New in 2.1
}Constructors
public ServletException()
public ServletException() public ServletException(String msg) public ServletException(String msg, Throwable rootCause) public ServletException(Throwable rootCause)
- Description
Constructs a new
ServletException, with an optional descriptive message and an optional “root cause” for the exception. If a message is specified, it can be retrieved by callinggetMessage( ); if a root cause is specified, it can be retrieved by callinggetRootCause( ). The messages and root cause are usually included in server logs and user error messages. The constructor versions taking a root cause were introduced in Servlet API 2.1.
Instance Methods
getRootCause()
public Throwable getRootCause()
- Description
Returns the
Throwableobject that caused the servlet exception ornullif there was no root cause. This method was introduced in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access