title: Exception when handling error trying to reset the response
body: <p>I'm getting this error in my JSF webapp: </p>
  
  <pre><code>Severe:   Error Rendering View[/core1/differentiation/polyquestion.xhtml]
  javax.el.ELException: /core1/differentiation/polyquestion.xhtml: Cannot create a session after the response has been committed
      at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:90)
      at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
      at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
      at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.IllegalStateException: Cannot create a session after the response has been committed
      at org.apache.catalina.connector.Request.doGetSession(Request.java:3241)
      at org.apache.catalina.connector.Request.getSession(Request.java:2884)
      at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908)
      at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:270)
      at com.sun.faces.context.ExternalContextImpl.getSession(ExternalContextImpl.java:167)
      at com.sun.faces.application.view.ViewScopeManager.processPostConstructViewMap(ViewScopeManager.java:275)
      at com.sun.faces.application.view.ViewScopeManager.processEvent(ViewScopeManager.java:244)
      at com.sun.faces.application.view.ViewScopeEventListener.processEvent(ViewScopeEventListener.java:68)
      at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
      at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:118)
      at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2169)
      at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2142)
      at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:294)
      at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1557)
      at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1502)
      at com.sun.faces.mgbean.BeanManager$ScopeManager$ViewScopeHandler.handle(BeanManager.java:550)
      at com.sun.faces.mgbean.BeanManager$ScopeManager.pushToScope(BeanManager.java:458)
      at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:410)
      at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
      at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:257)
      at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:117)
      at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
      at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
      at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116)
      at com.sun.el.parser.AstValue.getBase(AstValue.java:151)
      at com.sun.el.parser.AstValue.getValue(AstValue.java:200)
      at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
      at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:238)
      at com.sun.faces.facelets.el.ELText$ELTextComposite.writeText(ELText.java:154)
      at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:85)
      ... 46 more
  
  Info:   Exception when handling error trying to reset the response.
  java.lang.IllegalStateException: Cannot create a session after the response has been committed
      at org.apache.catalina.connector.Request.doGetSession(Request.java:3241)
      at org.apache.catalina.connector.Request.getSession(Request.java:2884)
      at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908)
      at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:270)
      at com.sun.faces.context.ExternalContextImpl.getSession(ExternalContextImpl.java:167)
      at com.sun.faces.application.view.ViewScopeManager.processPostConstructViewMap(ViewScopeManager.java:275)
      at com.sun.faces.application.view.ViewScopeManager.processEvent(ViewScopeManager.java:244)
      at com.sun.faces.application.view.ViewScopeEventListener.processEvent(ViewScopeEventListener.java:68)
      at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
      at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:118)
      at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2169)
      at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2142)
      at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:294)
      at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1557)
      at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1502)
      at com.sun.faces.mgbean.BeanManager$ScopeManager$ViewScopeHandler.handle(BeanManager.java:550)
      at com.sun.faces.mgbean.BeanManager$ScopeManager.pushToScope(BeanManager.java:458)
      at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:410)
      at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
      at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:257)
      at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:117)
      at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
      at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
      at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116)
      at com.sun.el.parser.AstValue.getBase(AstValue.java:151)
      at com.sun.el.parser.AstValue.getValue(AstValue.java:200)
      at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
      at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:238)
      at com.sun.faces.facelets.el.ELText$ELTextComposite.writeText(ELText.java:154)
      at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:85)
      at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
      at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
      at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
      at java.lang.Thread.run(Thread.java:745)
  
  Warning:   JSF1087: Unable to generate Facelets error page as the response has already been committed.
  Severe:   javax.faces.FacesException: Cannot create a session after the response has been committed
  javax.faces.FacesException: Cannot create a session after the response has been committed
      at com.sun.faces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:141)
      at javax.faces.context.ExceptionHandlerWrapper.handle(ExceptionHandlerWrapper.java:100)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.IllegalStateException: Cannot create a session after the response has been committed
      at org.apache.catalina.connector.Request.doGetSession(Request.java:3241)
      at org.apache.catalina.connector.Request.getSession(Request.java:2884)
      at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908)
      at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:270)
      at com.sun.faces.context.ExternalContextImpl.getSession(ExternalContextImpl.java:167)
      at com.sun.faces.application.view.ViewScopeManager.processPostConstructViewMap(ViewScopeManager.java:275)
      at com.sun.faces.application.view.ViewScopeManager.processEvent(ViewScopeManager.java:244)
      at com.sun.faces.application.view.ViewScopeEventListener.processEvent(ViewScopeEventListener.java:68)
      at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
      at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:118)
      at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2169)
      at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2142)
      at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:294)
      at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1557)
      at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1502)
      at com.sun.faces.mgbean.BeanManager$ScopeManager$ViewScopeHandler.handle(BeanManager.java:550)
      at com.sun.faces.mgbean.BeanManager$ScopeManager.pushToScope(BeanManager.java:458)
      at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:410)
      at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
      at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:257)
      at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:117)
      at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
      at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
      at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116)
      at com.sun.el.parser.AstValue.getBase(AstValue.java:151)
      at com.sun.el.parser.AstValue.getValue(AstValue.java:200)
      at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
      at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:238)
      at com.sun.faces.facelets.el.ELText$ELTextComposite.writeText(ELText.java:154)
      at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:85)
      at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
      at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
      at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      ... 35 more
  
  FATAL:   JSF1073: javax.el.ELException caught during processing of RENDER_RESPONSE 6 : UIComponent-ClientId=, Message=/core1/differentiation/polyquestion.xhtml: Cannot create a session after the response has been committed
  FATAL:   /core1/differentiation/polyquestion.xhtml: Cannot create a session after the response has been committed
  javax.el.ELException: /core1/differentiation/polyquestion.xhtml: Cannot create a session after the response has been committed
      at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:90)
      at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
      at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
      at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:890)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283)
      at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.IllegalStateException: Cannot create a session after the response has been committed
      at org.apache.catalina.connector.Request.doGetSession(Request.java:3241)
      at org.apache.catalina.connector.Request.getSession(Request.java:2884)
      at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908)
      at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:270)
      at com.sun.faces.context.ExternalContextImpl.getSession(ExternalContextImpl.java:167)
      at com.sun.faces.application.view.ViewScopeManager.processPostConstructViewMap(ViewScopeManager.java:275)
      at com.sun.faces.application.view.ViewScopeManager.processEvent(ViewScopeManager.java:244)
      at com.sun.faces.application.view.ViewScopeEventListener.processEvent(ViewScopeEventListener.java:68)
      at javax.faces.event.SystemEvent.processListener(SystemEvent.java:108)
      at javax.faces.event.ComponentSystemEvent.processListener(ComponentSystemEvent.java:118)
      at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2169)
      at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2142)
      at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:294)
      at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1557)
      at javax.faces.component.UIViewRoot.getViewMap(UIViewRoot.java:1502)
      at com.sun.faces.mgbean.BeanManager$ScopeManager$ViewScopeHandler.handle(BeanManager.java:550)
      at com.sun.faces.mgbean.BeanManager$ScopeManager.pushToScope(BeanManager.java:458)
      at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:410)
      at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)
      at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:257)
      at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:117)
      at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
      at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
      at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116)
      at com.sun.el.parser.AstValue.getBase(AstValue.java:151)
      at com.sun.el.parser.AstValue.getValue(AstValue.java:200)
      at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
      at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(ELText.java:238)
      at com.sun.faces.facelets.el.ELText$ELTextComposite.writeText(ELText.java:154)
      at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:85)
      ... 46 more
  </code></pre>
  
  <p>I looked around to see if I could find a solution to this error online, and came across this: <a href="https://stackoverflow.com/questions/11877420/jsf-error-illegalstateexception-pwc3999-cannot-create-a-session-after-the-re">JSF error - IllegalStateException: PWC3999: Cannot create a session after the response has been committed</a></p>
  
  <p>Which says the issue is a problem with Mojarra, that was fixed in version 2.1.8. However I'm using version 2.2.12.</p>
  
  <p>The problem doesn't seem to be dependent on the code I write. For example, my program could be running fine, but then I change one small line (it could be something as simple as the contents of a println), and it will flag this error. Then if I remove this change, it will still flag the error regardless, even after saving, clean building and restarting.</p>
  
  <p>Does anyone know where I'd even begin to start debugging this?</p>