File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes What happens after servlet throws an exception? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "What happens after servlet throws an exception?" Watch "What happens after servlet throws an exception?" New topic

What happens after servlet throws an exception?

Sam Zheng
Ranch Hand

Joined: Nov 29, 2000
Posts: 61

Hi everybody,
I have a question about exception handing in servlet.
If a servlet throws a ServletException in its service
public void service(HttpServletRequest req,
HttpServletResponse res) throws ServletException{

What happens after this service throws the exception?
Who catches this ServletException?
Does the thread running the servlet die thereafter?
Thanks for your help! Sam
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
if the service method throws servlet exception, since the method delegates handling the exception to the caller of the method, the thread (the Server) that calls the method is responsible. The thread just exits.


So much trouble in the world -- Bob Marley
Don't get me started about those stupid light bulbs.
subject: What happens after servlet throws an exception?
Similar Threads
How to send request data
ServletException logged differently in Tomcat 5.5 and Tomcat 6.0
get request with out doGet()
StringBuilder out of memory error
how to synchronize service() in servlets with out using singlethreadmodal interface