This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Another IllegalStateException  RSS feed

 
Usha Shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
Has anyone ever got this exception ?
java.lang.IllegalStateException: Context has not been prepared for next connection
at com.ibm.servlet.engine.srt.NilSRPConnection.getMethod(SRTConnectionContext.java:463)
 
Kirtikumar Puthran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Could you give a snip of your code..
Kirtikumar Puthran
 
Usha Shah
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure which code is causing it but the Servlet throws this error
The page which caused this error has some database calls and session.getAttribute and setAttribute calls
 
Rajni Kumar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hope u are getting Database connetion through Datasource(Connetion pool).
but ensure that after getting resultset, u are closing the Connection object.
 
Tim Holloway
Bartender
Posts: 18720
72
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IllegalState in a servlet is more often related to trying to do something like send back to the client after you've done a close on the HTTP output stream, though there are also illegal jdbc states.
However, based on your message, I suspect the best place to ask about this one is actually in the WebSphere forum.
 
Kirtikumar Puthran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Usha,
I got an IllegalStateException when write() was called on an OutputStream that has already closed. I reverified my code and made sure that I am not attempting to write to the output stream after the out.close().
Rgds,
Kirtikumar Puthran
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, that sounds like you are getting an exception of another sort after the output stream is closed, the servlet container is trying to report that exception but hits the closed stream. Then you get the illegal state but the real cause gets lost or buried in the stack trace.
Does your servlet do anything after closing the output stream?
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!