• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IllegalStateException in servlets

 
nilesh bhattad
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,
I'm getting following exception on WebSphere 3.5.2
WebAppInvoker X Unexpected internal engine error while processing request
java.lang.IllegalStateException: ERROR: Cannot set header. Response already committed.
This particlar exception is coming randomly. I'm sure that I'm not updating PrintWriter object after closing. According to Servlet APIs, this exception comes if you use Servlet Redirection. And I'm not using servlet redirection also.
Can u please help me out in this matter? What could be the reason behind this problem? I have some code related to HttpSession in my servlet? Is there any specific care that I have to take while using HttpSession?
Waiting for ur replies.
Thanks and regards
Nilesh
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
either response.sendRedirect or a RequestDispatcher forward command will give this illegal state exception if you've written anything (this includes 'blank' hard returns in JSP's) to the output stream.

you say you haven't redirected, but what about forwarding?
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"nrbhattad",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic