Blog dedicated to Oracle Applications (E-Business Suite) Technology; covers Apps Architecture, Administration and third party bolt-ons to Apps

Thursday, July 19, 2007

Unable to clear JspWriter buffer, data already written to stream

While trying to login to Apps the following error is displayed:

Message: Unable to clear JspWriter buffer, data already written to stream.
Stack: Unable to clear JspWriter buffer, data already written to stream.
at oracle.jsp.runtime.OracleJspWriter.clear(
at _oa__html._z__gepp__voc._jspService(
at oracle.jsp.runtime.HttpJsp.service(
at oracle.jsp.JspServlet.doDispatch(
at oracle.jsp.JspServlet.internalService(
at oracle.jsp.JspServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.jserv.JServConnection.processRequest(

On 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 are specified, the buffer is always flushed before the target page is invoked. This means that you can't set headers or use after a action.

An unfortunate side-effect of this automatic flushing is that runtime errors triggered by JSP elements after a action may not be reported correctly, since many JSP containers use the forward mechanism to display the error page. If you see an error message like "response already committed" in a page with elements, I suggest that you use the include directive instead (at least until you have isolated the problem).

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.

No comments: