tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard Watson" <>
Subject Re: Sudden IllegalStateException
Date Thu, 01 Jan 2004 01:43:26 GMT
May be I'm trying to help with something over my head. When I had this error I read about using
Return and could not visualize where from a servlet I would return to in a JSP....., so I
know I need to research this.

However, the point is from the faq link I gave you:
 These are the most common reasons how you can get an java.lang.IllegalStateException:
 The response has been committed and you do any of the following

which I believe is same thing bpsouther is saying.

If for instance you execute sendRedirect and a doPost begins to execute (this was my case)
and encounters another sendRedirect you will get an error because the previous sendRedirect
has already set the header.

The key thing is that somewhere in your nested code a response has begun before the sendRedirect
that is throwing an error.

Since at this point I can't visualize a single Return I probably can't help you with a nested

>>> 12/31/03 16:40 PM >>>

There are three sendRedirect() calls in the servlet.  The first two 
redirect back to the login page if with the login user id is not found 
or  the login password doesn't match.  In both cases, the sendRedirect() 
is immediately followed by a return.  (I learned to use explicit returns 
after sendRedirect() some time ago.)

The sendRedirect() that is throwing the error is the last statement in 
the overall try{} block.  There is a catch for SQLException which calls 
a function that would call sendRedirect() to get to the error page, but 
if we've gotten to the last statement in the try{} block, there was no 
SQLException. The only thing after the try{}/catch{} is again a return.


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message