I currently have a dataTable connecting to a database. It all worked fine including insert and delete. I then tried to add editing into my dataTable and all of a sudden I get the following error:
SEVERE: Servlet.service() for servlet [FacesServlet] in context with path [/ProEJT] threw exception [null] with root cause java.lang.NullPointerException at org.primefaces.component.celleditor.CellEditorRenderer.encodeEnd(CellEditorRenderer.java:38) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) at org.primefaces.component.datatable.DataTableRenderer.encodeCell(DataTableRenderer.java:823) at org.primefaces.component.datatable.DataTableRenderer.encodeRow(DataTableRenderer.java:784) at org.primefaces.component.datatable.DataTableRenderer.encodeRows(DataTableRenderer.java:699) at org.primefaces.component.datatable.DataTableRenderer.encodeTbody(DataTableRenderer.java:654) at org.primefaces.component.datatable.DataTableRenderer.encodeRegularTable(DataTableRenderer.java:249) at org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:211) at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:83) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786) at javax.faces.render.Renderer.encodeChildren(Renderer.java:168) at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:437) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124) 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:139) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
As far as I can tell, this does not tell me where the NullPointerException comes from in my code. I have tried what feels like a million different things with no luck.
My dataTable:
<h:form id="form1">
<p:growl id="growl" showDetail="true" life="3000"/>
<p:dataTable id="dataTable"
var="order"
value="#{checkOut.orders}"
ajax="true"
paginator="true"
selection="#{checkOut.selectedOrder}"
selectionMode="single"
rowKey="#{order.id}"
rows="10"
sortMode="Multiple"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
emptymessage="No orders found"
rowsPerPageTemplate="5,10,15"
rowStyleClass="#{(order.state == 'ERROR' ? 'error' : (order.state == 'Finished' ? 'finished' : (order.state == 'Failed' ? 'failed':(order.state == 'Paused' ? 'paused' : null ))))}"
editable="true"
editMode="row">
<f:facet name="header">
Conversions
</f:facet>
<p:ajax event="rowEdit" listener="#{checkOut.onEdit}" update=":form:growl" />
<p:ajax event="rowEditCancel" listener="#{checkOut.onCancel}" update=":form:growl"/>
<p:column sortBy="#{order.id}">
<p:cellEditor >
<f:facet name="Output">
<h:outputText value="#{order.id}"/>
</f:facet>
<f:facet name="Input">
<p:inputText value="#{order.id}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column sortBy="#{order.created}" >
<p:cellEditor >
<f:facet name="Output">
<h:outputText value="#{order.created}"/>
</f:facet>
<f:facet name="Input">
<p:inputText value="#{order.created}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column sortBy="#{order.sender}" >
<p:cellEditor >
<f:facet name="Output">
<h:outputText value="#{order.sender}"/>
</f:facet>
<f:facet name="Input">
<p:inputText value="#{order.sender}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column sortBy="#{order.receiver}">
<p:cellEditor >
<f:facet name="Output">
<h:outputText value="#{order.receiver}"/>
</f:facet>
<f:facet name="Input">
<p:inputText value="#{order.receiver}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column sortBy="#{order.input}" >
<p:cellEditor >
<f:facet name="Output">
<h:outputText value="#{order.input}"/>
</f:facet>
<f:facet name="Input">
<p:inputText value="#{order.input}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column sortBy="#{order.output}">
<p:cellEditor >
<f:facet name="Output">
<h:outputText value="#{order.output}"/>
</f:facet>
<f:facet name="Input">
<p:inputText value="#{order.output}" style="width:100%"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column sortBy="#{order.state}">
<p:cellEditor >
<f:facet name="Output">
<h:outputText value="#{order.state}"/>
</f:facet>
<f:facet name="Input">
<p:inputText value="#{order.state}" style="width:100%"/>
</f:facet>
</p:cellEditor>
<p:progressBar id="progressBarClient" value="#{checkOut.retrieveProgress(order.state)}" labelTemplate="{value}%" displayOnly="true"/>
</p:column>
<p:column >
<p:commandLink id="btnDeleteRow" action="#{checkOut.deleteRow(order)}" update="dataTable" ajax="true">
<h:graphicImage value="/img/DeleteRed.png" style="align:center" width="30" height="30"/>
</p:commandLink>
<p:rowEditor />
</p:column>
</p:dataTable>
<p:commandButton id="new" value="Create A New Order" update=":orderForm" oncomplete="newOrderDialog.show()" style="position:absolute; dataTable:10px; left:7px;"/>
<p:commandButton id="logout" value="Log Out" update="growl" action="#{checkOut.logout}" style="position:absolute; dataTable:10px; right:10px"/>
</h:form>
dataTable
doesn't haveajax
attribute as far as I know. – Xtreme Biker