title: java.lang.NullPointerException at com.sun.faces.context.PartialViewContextImpl.createPartialResponseWriter
body: <p>I have in my JSF 2 app on JBoss AS 7.1 a PrimeFaces 5.1 datatable with lazy loading and it sorts on page load, so I know my sorting implementation works, but when I click the column to sort it throws the below exception.</p>
  
  <pre><code>17:48:34,855 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/feenix].[Faces Servlet]] (http-/0:0:0:0:0:0:0:0:8080-6) JBWEB000236: Servlet.service() for servlet Faces Servlet threw exception: 
  java.lang.NullPointerException
      at com.sun.faces.context.PartialViewContextImpl.createPartialResponseWriter(PartialViewContextImpl.java:469) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
      at com.sun.faces.context.PartialViewContextImpl.access$300(PartialViewContextImpl.java:76) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
      at com.sun.faces.context.PartialViewContextImpl$DelayedInitPartialResponseWriter.getWrapped(PartialViewContextImpl.java:603) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
      at javax.faces.context.PartialResponseWriter.startDocument(PartialResponseWriter.java:115) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1]
      at org.primefaces.context.PrimePartialResponseWriter.startDocument(PrimePartialResponseWriter.java:152) [primefaces-5.1.jar:5.1]
      at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:201) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
      at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:126) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
      at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.28.redhat-3.jar:2.1.28.redhat-3]
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.1.28.Final-redhat-1.jar:2.1.28.Final-redhat-1]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
  </code></pre>
  
  <p>My data table:</p>
  
  <pre><code>&lt;p:dataTable var="registroD" value="#{reportes.diario}" paginator="true" rows="10" rowsPerPageTemplate="10,20,40,80" id="registroDiarioTable" lazy="true"
                                       paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"&gt;
      &lt;p:column headerText="Fecha"&gt;
          &lt;h:outputText value="#{registroD.fechaRegistro}"&gt;
              &lt;f:convertDateTime pattern="yyyy/MM/dd" type="date"/&gt;
          &lt;/h:outputText&gt;
      &lt;/p:column&gt;
      &lt;p:column headerText="Nombre Asesor" sortBy="#{registroD.idTrabajo.idUsuario.nombres}" filterBy="#{registroD.idTrabajo.idUsuario.nombres}"&gt;
          &lt;h:outputText value="#{registroD.idTrabajo.idUsuario.nombres}"/&gt;
      &lt;/p:column&gt;
      &lt;p:column headerText="Apellido Asesor" sortBy="#{registroD.idTrabajo.idUsuario.apellidos}" filterBy="#{registroD.idTrabajo.idUsuario.apellidos}"&gt;
          &lt;h:outputText value="#{registroD.idTrabajo.idUsuario.apellidos}"/&gt;
      &lt;/p:column&gt;
      &lt;p:column headerText="Lugar entrega" sortBy="#{registroD.idTrabajo.idUbicacion.direccion}" filterBy="#{registroD.idTrabajo.idUbicacion.direccion}"&gt;
          &lt;h:outputText value="#{registroD.idTrabajo.idUbicacion.direccion}"/&gt;
      &lt;/p:column&gt;
      &lt;p:column headerText="Hora entrega"&gt;
          &lt;h:outputText value="#{registroD.fechaRegistro}"&gt;
              &lt;f:convertDateTime pattern="HH:mm:ss" type="time"/&gt;
          &lt;/h:outputText&gt;
      &lt;/p:column&gt;
      &lt;p:column headerText="Nombre" sortBy="#{registroD.numero.nombres}" filterBy="#{registroD.numero.nombres}"&gt;
          &lt;h:outputText value="#{registroD.numero.nombres}"/&gt;
      &lt;/p:column&gt;
      &lt;p:column headerText="Apellido" sortBy="#{registroD.numero.apellidos}" filterBy="#{registroD.numero.apellidos}"&gt;
          &lt;h:outputText value="#{registroD.numero.nombres}"/&gt;
      &lt;/p:column&gt;
      &lt;p:column headerText="Numero Celular" sortBy="#{registroD.numero.numero}" filterBy="#{registroD.numero.numero}"&gt;
          &lt;h:outputText value="#{registroD.numero.numero}" /&gt;
      &lt;/p:column&gt;
      &lt;p:column headerText="Producto" sortBy="#{registroD.producto}" filterBy="#{registroD.producto}"&gt;
          &lt;h:outputText value="#{registroD.producto}"/&gt;
      &lt;/p:column&gt;
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>This error has nothing to do (seems to me that way) with the actions I do.</p>
  
  <p>What is going on?</p>