java将异常写到text,javax.servlet.ServletException:WriteText方法无法写入空文本

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

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

Edit:1

I think this would be the relevant part for this

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)

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

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

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

rows="10" autocomplete="false"

minChars="2" width="150"

value="#{inputPersonal.selectedplcofBirth}"

filterMatchMode="none"

valueChangeListener="#{inputPersonal.valueChangeEventCity}">

is messing up.Any idea Why this is hapening?

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)

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

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

Upgrade Mojarra version in production server. It's currently already at 2.1.14.

Make sure that no one of your components ever receive a null value by conditionally rendering it only when the value is not empty.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值