10.11. Servlet Exceptions

When writing servlets that are anything more than the most basic of handlers, the developer will find that exceptions and errors can occur during runtime. For example, the servlet may be temporarily unavailable due to administrative action or failure to obtain certain resources such as memory or access to an external server. As with any Java application, a good knowledge of exception handling is required to create for the user a stable and robust system.

The general exception that servlets throw is the ServletException. This can be used to cover problems in most cases, and is normally handled correctly by the servlet engine, allowing other servlets to continue running.

The next exception is the UnavailableException

Get Java™ Network Programming and Distributed Computing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.