javax.servlet.ServletException:WriteText方法无法写入空文本 [英] javax.servlet.ServletException: WriteText method cannot write null text

查看:74
本文介绍了javax.servlet.ServletException:WriteText方法无法写入空文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have created a Web application using JSF+Icefaces+Richfaces+Primefaces.It is working great while I run it from eclipse as a project but When I created its WAR file and deployed in GlassFish Server then while rendering a page it is throwing this exception

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

我进行了搜索,但没有找到任何好的解决方案.我们非常感谢您的快速帮助


1
我认为这将是与此相关的部分

I searched but didn't get any good solution.A quick help is highly appreciated


1
I think this would be the relevant part for this

                        <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)搜索 (2)高级搜索
当我单击搜索"时,它会显示搜索页面(通过渲染-实际上,我已将所有页面都包含在母版页中,并通过命令链接功能进行渲染)

Here you can see two links (1) Search and (2) Advance Search
when I click on Search , It shows search page (By rendering-Actually I have included all pages in masterpage and render them on commandlink functions)

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

但是当我单击高级搜索"链接(此部分应在其上呈现)

But When I click on Advance Search link (on which this part should render)

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

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

The browser show the above exception.
NOTE: Keep in mind that this problem is occurring in deploying.It is not coming in actual application when I run it from eclipse from code

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

2 I found in server logs that this exception is coming due to acefaces and this portion of code

<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>

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

is messing up.Any idea Why this is hapening?



编辑#3:
这是异常的完整痕迹



Edit #3:
Here is the full tack trace of exception

[#|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)
|#]

推荐答案

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中的错误引起的. <h:outputFormat>null值未正确处理.据报道这是问题2351 ,自Mojarra 2.1.9起已修复.

This is in first place caused by a bug in Mojarra. A null value of <h:outputFormat> isn't been dealt properly with. This has been reported as issue 2351 which is been fixed since Mojarra 2.1.9.

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

Apparently the server in production is running an older version of Mojarra. You have 2 options:

  1. 在生产服务器中升级Mojarra版本.当前是 .
  2. 通过仅在值为not empty时才有条件地呈现null值,确保没有任何<h:outputFormat>组件收到过null值.
  1. Upgrade Mojarra version in production server. It's currently already at 2.1.14.
  2. Make sure that no one of your <h:outputFormat> components ever receive a null value by conditionally rendering it only when the value is not empty.

这篇关于javax.servlet.ServletException:WriteText方法无法写入空文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆