This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception

 
vasu maj
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Thanks,
Vasu
 
himanshu patel
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you close the outputStream ?
 
vasu maj
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Vasu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic