"Response Has Already Been Committed" Appended To File Downloaded Through An ADF Faces Application

(Doc ID 603092.1)

Last updated on MARCH 08, 2017

Applies to:

Oracle JDeveloper - Version to [Release Oracle10g]
Information in this document applies to any platform.


When downloading a file through an ADF Faces application, an exception stack trace is appended to the end of the text file.

The problem can not be reproduced in the Embedded OC4J server of JDeveloper
However the problem happens when the application is deployed to Oracle AS server
The code in the backing bean:

HttpServletResponse response = JSFUtils.getHttpServletResponse();
InputStream in = null;
OutputStream out = null;
try {
   in = new BufferedInputStream(new FileInputStream(file));
    out = response.getOutputStream();
    byte[] buffer = new byte[1024];
    int len = 0;
    while ((len = in.read(buffer)) != -1) {
       out.write(buffer, 0, len);

The exception stack trace appended in the end of text file:

java.lang.IllegalStateException: Response has already been committed
at com.evermind[Oracle Application Server Containers for J2EE 10g(].server.http.EvermindHttpServletResponse.resetBuffer(EvermindHttpServletResponse.java:1902)
at javax.servlet.ServletResponseWrapper.resetBuffer(ServletResponseWrapper.java:215)
at javax.servlet.ServletResponseWrapper.resetBuffer(ServletResponseWrapper.java:215)
at com.evermind[Oracle Application Server Containers for J2EE 10g(].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:251)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:346)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
at oracle.adfinternal.view.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:157)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)

This reproduces even for small files.
For example, a file which has only one character 'a', will be downloaded as:

a<PRE>java.lang.IllegalStateException: Response has already been committed<br> at com.evermind ...



Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms