我们将JSF从2.1.6升级到2.1.22以解决此问题:JSF error - IllegalStateException: PWC3999: Cannot create a session after the response has been committed
它有效。但是JSF版本的更改引起了另一个问题:在视图中找不到某些组件,而GlassFish抛出了一个有两个例外的堆栈跟踪。第一个:
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)
...
第二个:
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)
...
标识符为“indexForm:publicacoesDt:j_idt112”的组件是PrimeFaces的commandLink,“:previewForm”是JSF表单。当触发使用commandLink更新表单的commandButton时会发生此问题。但就在第二次提交中,第一次提交是成功的。
任何人都知道为什么会出现这个问题?