Message: Unable to clear JspWriter buffer, data already written to stream.
java.io.IOException: Unable to clear JspWriter buffer, data already written to stream.
On http://www.oreillynet.com/pub/a/oreilly/java/news/jsptips_1100.html tip 2 provides details of why this error occurs:
Dealing with Buffer Flushing Issues
An HTTP response message contains both headers and a body. The headers tell the browser things like what type of data the body contains (HTML text, an image), the size of the body, if the body can be cached, and so on. Headers are also used to set cookies and to tell the browser to automatically get another page (a redirect). All response headers must be sent to the browser before the body is sent.
To allow parts of the body to be produced (from static template text as well as content generated dynamically by JSP elements) before headers are set, the body is buffered. Instead of sending the response to the browser as soon as something is written to the response body, the JSP container writes all static markup code and all dynamic content generated by JSP elements to the buffer. At some point, such as when the buffer is full or the end of the page is reached, the container sends all headers that have been set followed by the buffered body content. In servlet speak, this is called committing the response. After the response has been committed, you can't set headers, such as for cookies or a redirection instruction. Another thing you can't do is forward the request to another page.
In most cases, this is not a problem. The default buffer size is 8KB, more than enough for a typical page, and you can increase it with the buffer attribute of the page directive. But if you use the include action in a page, you may be in for a surprise. Due to limitations in the way the servlet features used by
An unfortunate side-effect of this automatic flushing is that runtime errors triggered by JSP elements after a
Workaround: Bounce Apache. One hit in Metalink for this error is note 234431.1 which is in iStore and as expected is a bug (code error) for which a specific iStore patch is suggested.
If you get this issue too often, log an SR with Oracle to get a patch.