java.lang.IllegalStateException: Response already committed

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • db:: 4.40::BEA-101020 error ac
    via by Unknown author,
  • From the javadoc for ExternalContext.redirect(): http://docs.oracle.com/javaee/6/api/javax/faces/context/ExternalContext.html#redirect%28java.lang.String%29 "Throws: IllegalStateException - if, in a servlet environment, the current response has already been committed" This works fine for full page refresh / submit. We see this exception when attempting to write to response stream after response is complete: java.lang.IllegalStateException: Response already committed at weblogic.servlet.internal.ServletResponseImpl.objectIfCommitted(ServletResponseImpl.java:1608) at weblogic.servlet.internal.ServletResponseImpl.sendRedirect(ServletResponseImpl.java:834) at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:136) at com.sun.faces.context.ExternalContextImpl.redirect(ExternalContextImpl.java:421) However for Partial page submit / AJAX case, this exception is not raised, and there is possibility of writing to response even after the response is logically complete. The bug is evident looking at the implementation of redirect() method in ExternalContext: 549 /** 550 * @see ExternalContext#redirect(String) 551 */ 552 public void redirect(String requestURI) throws IOException { 553 554 FacesContext ctx = FacesContext.getCurrentInstance(); 555 getELFlash().doLastPhaseActions(ctx, true); 556 557 if (ctx.getPartialViewContext().isAjaxRequest()) { 558 PartialResponseWriter pwriter; 559 ResponseWriter writer = ctx.getResponseWriter(); 560 if (writer instanceof PartialResponseWriter) { 561 pwriter = (PartialResponseWriter) writer; 562 } else { 563 pwriter = ctx.getPartialViewContext().getPartialResponseWriter(); 564 } 565 setResponseContentType("text/xml"); 566 setResponseCharacterEncoding("UTF-8"); 567 addResponseHeader("Cache-Control", "no-cache"); 568 pwriter.startDocument(); 569 pwriter.redirect(requestURI); 570 pwriter.endDocument(); 571 } else { 572 ((HttpServletResponse) response).sendRedirect(requestURI); 573 } 574 ctx.responseComplete(); 575 576 } The Servlet specification essentially says that sendRedirect() commits the request, so a second sendRedirect() will throw an IllegalStateException. For the AJAX case, looks like the above implementation is simply using a redirect header and is likely rendering content to perform the redirect. Furthermore looks like for AJAX case call to redirect() does not result in calling FacesContext.responseComplete(), which is not right. The consequence of this is bug in JSF based applications that in AJAX case, the response can contain as many redirects as possible, which is invalid to do so. Expected: Mojarra should implement the redirect semantics correctly and completely for the partial rendering / AJAX case as is done for the full page refresh case. Testcase: Code like the following when executed for AJAX request should show the issue: ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext(); HttpSession session = (HttpSession)ectx.getSession(true); String temp = session.getServletContext().getContextPath() + "/faces/welcomePage.jspx"; String temp2 = session.getServletContext().getContextPath() + "/faces/mainPage.jspx"; try { boolean complete1 = FacesContext.getCurrentInstance().getResponseComplete(); ectx.redirect(temp); boolean complete2 = FacesContext.getCurrentInstance().getResponseComplete(); ectx.redirect(temp2); boolean complete3 = FacesContext.getCurrentInstance().getResponseComplete(); } catch (Exception ex) { ex.printStackTrace(); }
    via by prakashudupa,
  • BPM Workspace and Composer login problem
    via by 380288f9-7f88-44ae-bb5e-10c861cf2917,
  • BPM workspace login failed
    via by Ravi Kapur,
  • BPM Workspace Issue.
    via by kasiraju.rudraraju,
    • java.lang.IllegalStateException: Response already committed at weblogic.servlet.internal.ServletResponseImpl.objectIfCommitted(ServletResponseImpl.java:1725) at weblogic.servlet.internal.ServletResponseImpl.sendRedirect(ServletResponseImpl.java:922) at weblogic.servlet.internal.ServletResponseImpl.sendRedirect(ServletResponseImpl.java:918) at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:168) at com.sun.faces.context.ExternalContextImpl.redirect(ExternalContextImpl.java:576) at javax.faces.context.ExternalContextWrapper.redirect(ExternalContextWrapper.java:462) at javax.faces.context.ExternalContextWrapper.redirect(ExternalContextWrapper.java:462) at javax.faces.context.ExternalContextWrapper.redirect(ExternalContextWrapper.java:462) at javax.faces.context.ExternalContextWrapper.redirect(ExternalContextWrapper.java:462) at oracle.adfinternal.view.faces.config.rich.DetectRedirect.redirect(DetectRedirect.java:66) at javax.faces.context.ExternalContextWrapper.redirect(ExternalContextWrapper.java:462) at oracle.adfinternal.controller.util.JsfInterfaceImpl.redirectToUrl(JsfInterfaceImpl.java:100) at oracle.adfinternal.controller.util.JsfInterfaceImpl.redirectToViewId(JsfInterfaceImpl.java:85) at oracle.adfinternal.controller.state.RootViewPortContextImpl.redirect(RootViewPortContextImpl.java:163) at oracle.adfinternal.controller.application.AdfcExceptionHandler.doExceptionHandling(AdfcExceptionHandler.java:196) at oracle.adfinternal.controller.application.AdfcExceptionHandler.handleException(AdfcExceptionHandler.java:97) at oracle.adfinternal.view.faces.context.RichExceptionHandler._invokeAdfExceptionHandlers(RichExceptionHandler.java:202) at oracle.adfinternal.view.faces.context.RichExceptionHandler._handleUnexpectedException(RichExceptionHandler.java:178) at oracle.adfinternal.view.faces.context.RichExceptionHandler._handleException(RichExceptionHandler.java:128) at oracle.adfinternal.view.faces.context.RichExceptionHandler._handleNextEvent(RichExceptionHandler.java:113) at oracle.adfinternal.view.faces.context.RichExceptionHandler.handle(RichExceptionHandler.java:98) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:233) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at oracle.help.web.rich.OHWFilter.doFilter(OHWFilter.java:197) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:192) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:105) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:502) at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:502) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:327) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:229) at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:202) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:137) at java.security.AccessController.doPrivileged(Native Method) at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315) at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460) at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:120) at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:217) at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:81) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:220) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311) at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    4 more bugmates