wood burning stoves 2.0*
The moose likes JSP and the fly likes exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "exception" Watch "exception" New topic


vasu maj
Ranch Hand

Joined: Jul 12, 2001
Posts: 395
I am getting this exception and am not able to narrow it. Anyone has an idea?

java.lang.IllegalStateException: getWriter() has already been called for this response

What a wonderful world!
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
That is one of the clearest exceptions that you can get. It really means what it says.
You must search your code for "getWriter" or "getOutputStream" - wasn't there also a line number? That should help.
vasu maj
Ranch Hand

Joined: Jul 12, 2001
Posts: 395
This is not as it was saying actually. There was a null pointer exception masked inside. The XML document's rot that I was creating was being referenced before it was initialized. Iwas able to get to the exception by priting the stacktrace which I was not doing before.
himanshu patel
Ranch Hand

Joined: Feb 03, 2003
Posts: 205
Did you close the outputStream ?

If you want to become a rich, do not work for others but make others to work for you.
vasu maj
Ranch Hand

Joined: Jul 12, 2001
Posts: 395
I am not closing the outputStream at any time. In this particular instance it was not the problem of not closing it. But what if I never close it, as what I am doing now... I didn't face any problem so far.
I agree. Here's the link: http://aspose.com/file-tools
subject: exception
Similar Threads
CMP Exception Handling
Struts exception handling best practices?
An exception
create xml string from data
Which exception is thrown?