title: NPE at TreeTableRenderer.encodeEnd
body: <p>This is my TreeTable definition on xhtml page:</p>
  
  <pre><code>&lt;p:treeTable var="r" value="#{mybean.tree}"&gt;
  </code></pre>
  
  <p>I can see in catalina.out file that every day this happens a few times:</p>
  
  <pre><code>12-Jan-2015 10:13:00.119 SEVERE [ajp-apr-8009-exec-211] com.sun.faces.application.view.FaceletViewHandlingStrategy.handleRenderException Error Rendering View[/my_page.xhtml]
       java.lang.NullPointerException
          at org.primefaces.component.treetable.TreeTableRenderer.encodeEnd(TreeTableRenderer.java:127)
          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
          at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:582)
          at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
          at org.primefaces.component.api.UITree.visitTree(UITree.java:648)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at javax.faces.component.UIForm.visitTree(UIForm.java:371)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:403)
          at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:322)
          at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:60)
          at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1004)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
          at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:430)
          at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133)
          at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
          at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
          at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
          at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:831)
          at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
          at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2344)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
          at java.lang.Thread.run(Thread.java:745)
  
      12-Jan-2015 10:13:00.120 SEVERE [ajp-apr-8009-exec-211] com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError java.lang.NullPointerException
          at org.primefaces.component.treetable.TreeTableRenderer.encodeEnd(TreeTableRenderer.java:127)
          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)
          at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:582)
          at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
          at org.primefaces.component.api.UITree.visitTree(UITree.java:648)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at javax.faces.component.UIForm.visitTree(UIForm.java:371)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
          at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:403)
          at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:322)
          at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:60)
          at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:1004)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)
          at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:430)
          at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133)
          at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
          at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
          at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
          at org.apache.coyote.ajp.AbstractAjpProcessor.process(AbstractAjpProcessor.java:831)
          at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
          at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2344)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
          at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>I haven't gottten any user complaints and am not sure yet what the user is doing when this happens. I was assuming she is just opening the page but because of <code>handlePartialResponseError</code> I guess it could be also expanding/collapsing.</p>
  
  <p>Does the error indicate that my object is <code>null</code> in one entry of the tree? In my code I have made sure no nulls are added so this should not be the case.</p>
  
  <p><code>mybean</code> is a <code>@SessionScoped</code> <code>@ManagedBean</code> (used to be <code>@ViewScoped</code> but now the tree is cached for each user).</p>
  
  <p>My setup is:</p>
  
  <ul>
  <li>Tomcat 8.0.15</li>
  <li>Mojarra 2.2.8</li>
  <li>Primefaces 5.1</li>
  <li>RHEL 7.0</li>
  </ul>