*
The moose likes Servlets and the fly likes IllegalStateException in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "IllegalStateException in servlets" Watch "IllegalStateException in servlets" New topic
Author

IllegalStateException in servlets

nilesh bhattad
Greenhorn

Joined: Jan 15, 2003
Posts: 8
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

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Jan 07, 1999
Posts: 6920
"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.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IllegalStateException in servlets
 
Similar Threads
Problem with passing object from servlet to applet using jsp page
Value for the useBean class attribute is invalid -- why?
Servlet Chaining in an Application Server
Unable to create cookies
Servlet Download Problem