0

我已经使用JSF+Icefaces+Richfaces+Primefaces创建了一个 Web 应用程序。当我从 eclipse 作为项目运行它时它工作得很好,但是当我创建它的 WAR 文件并部署在 GlassFish Server 中然后在渲染页面时它会抛出这个异常

javax.servlet.ServletException: WriteText method cannot write null text

我搜索但没有得到任何好的解决方案。非常感谢快速帮助


编辑:1
我认为这将是相关的部分

                        <li class="page_item" id="liMasterSearch">      <!-- this is for hide (<li class="page_item hide" id="liMasterSearch"> applied to every class) -->
                            <h:commandLink value="Search" action="#{masterRenderBean.showSimpleSearch}"></h:commandLink>
                        </li>

                        <li class="page_item" id="liAdvanceSearch">
                            <h:commandLink value="Advance Search" action="#{masterRenderBean.showADVS}"></h:commandLink>
                        </li>

在这里您可以看到两个链接(1) Search (2) Advance Search
当我单击 Search 时,它显示了搜索页面(通过渲染-实际上我已将所有页面包含在 masterpage 中并在 commandlink 函数上渲染它们)

 <h:panelGroup rendered="#{not masterRenderBean.simpleSearch}">
            <ui:include src="../../WebPages/SearchPages/MasterSearch.xhtml"></ui:include>
            </h:panelGroup>

但是当我点击高级搜索链接时(这部分应该在上面呈现)

<h:panelGroup rendered="#{not masterRenderBean.advs}">  
        <ui:include src="../../WebPages/SearchPages/PersonalAdvanceSearch.xhtml"/>
        </h:panelGroup>

浏览器显示上述异常。
注意:请记住,这个问题是在部署中发生的。当我从代码中的 eclipse 运行它时,它并没有出现在实际应用程序中

编辑:2我在服务器日志中发现此异常是由于 acefaces 和这部分代码

<ace:autoCompleteEntry id="txtplaceofbirth"
                                      rows="10" autocomplete="false" 
                                        minChars="2" width="150" 
                                        value="#{inputPersonal.selectedplcofBirth}" 
                                        filterMatchMode="none"  
                                       valueChangeListener="#{inputPersonal.valueChangeEventCity}">
                                        <f:selectItems value="#{inputPersonal.cities}"/>

                                        </ace:autoCompleteEntry></h:outputFormat>

搞砸了。知道为什么会这样吗?



编辑#3:
这是异常的完整跟踪

[#|2012-11-19T09:55:48.026+0500|SEVERE|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=53;_ThreadName=Thread-2;|java.lang.NullPointerException: WriteText method cannot write null text
    at org.icefaces.impl.context.DOMResponseWriter.writeText(DOMResponseWriter.java:314)
    at org.icefaces.impl.context.DOMResponseWriter.writeText(DOMResponseWriter.java:340)
    at com.sun.faces.renderkit.html_basic.OutputMessageRenderer.encodeEnd(OutputMessageRenderer.java:163)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1764)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    at org.icefaces.impl.renderkit.RendererWrapper.encodeChildren(RendererWrapper.java:49)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
    at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    at org.icefaces.impl.renderkit.RendererWrapper.encodeChildren(RendererWrapper.java:49)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
    at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:142)
    at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:391)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:722)
|#]
4

1 回答 1

0
java.lang.NullPointerException: WriteText method cannot write null text
    at org.icefaces.impl.context.DOMResponseWriter.writeText(DOMResponseWriter.java:314)
    at org.icefaces.impl.context.DOMResponseWriter.writeText(DOMResponseWriter.java:340)
    at com.sun.faces.renderkit.html_basic.OutputMessageRenderer.encodeEnd(OutputMessageRenderer.java:163)

这首先是由 Mojarra 中的一个错误引起的。未正确处理的null值。<h:outputFormat>这已报告为问题 2351,自 Mojarra 2.1.9 以来已修复。

显然,生产中的服务器正在运行旧版本的 Mojarra。您有 2 个选项:

  1. 在生产服务器中升级 Mojarra 版本。目前已经是 2.1.14。
  2. <h:outputFormat>通过仅null在值为not empty.
于 2012-11-19T10:53:36.787 回答