We upgraded JSF from 2.1.6 to 2.1.22 to solve this problem: JSF error - IllegalStateException: PWC3999: Cannot create a session after the response has been committed
And it works. But the change of JSF version caused another problem: some components are not found in view and GlassFish threw a stacktrace with two exceptions. The first:
javax.faces.FacesException: Cannot find component with identifier ":previewForm" referenced from "indexForm:publicacoesDt:j_idt112".
at org.primefaces.util.ComponentUtils.findClientIds(ComponentUtils.java:271)
at org.primefaces.util.AjaxRequestBuilder.addIds(AjaxRequestBuilder.java:102)
at org.primefaces.util.AjaxRequestBuilder.update(AjaxRequestBuilder.java:90)
at org.primefaces.renderkit.CoreRenderer.buildAjaxRequest(CoreRenderer.java:196)
at org.primefaces.component.commandlink.CommandLinkRenderer.encodeEnd(CommandLinkRenderer.java:64)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:905)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
...
And the second:
PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: CDATA tags may not nest
at com.sun.faces.renderkit.html_basic.HtmlResponseWriter.startCDATA(HtmlResponseWriter.java:664)
at javax.faces.context.ResponseWriterWrapper.startCDATA(ResponseWriterWrapper.java:172)
at javax.faces.context.PartialResponseWriter.startError(PartialResponseWriter.java:342)
at org.primefaces.context.PrimePartialResponseWriter.startError(PrimePartialResponseWriter.java:155)
at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:200)
at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:124)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
...
The component with identifier "indexForm:publicacoesDt:j_idt112" is a commandLink from PrimeFaces and the ":previewForm" is a JSF form. This problem happens when a commandButton, that updates a form with the commandLink, is fired. But just in the second submission, the first is successful.
Anyone know why this problem happens?