DataTable PWC1406 NullPointerException java.io.Writer.write

UI Components for JSF
Post Reply
jlferreira
Posts: 43
Joined: 16 Nov 2010, 17:52

24 Nov 2010, 14:26

Hi all.
I created an In-Cell dataTable that shows the results correctly, but when I try to edit the cell contents the following error is displayed in glassfish log file:

Code: Select all

WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
	at java.io.Writer.write(Writer.java:140)
	at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:200)
	at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:119)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
	at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
	at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
	at java.lang.Thread.run(Thread.java:619)
Nothing happens after this error (the confirm and cancel links/buttons does not work).

This is the dataTable creation:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
	<f:view>
			<ui:insert name="padraocabecalho">
				<ui:include src="/resources/templates/padraocabecalhopfp.xhtml" />
			</ui:insert>
		<p:growl id="growl"/>
		
		<h:form>
		    <p:dataTable onRowEditUpdate="growl" value="#{segGruposController.lseggrupos}" var="c" id="segGruposList">
				<f:facet name="header">  
					Grupos de Segurança   
				</f:facet>  

				<p:column headerText="Código" style="width:350px">  
					<p:cellEditor>  
						<f:facet name="output">  
							<h:outputText value="#{c.segGruposCodigo}" />  
						</f:facet>  
						<f:facet name="input">  
							<h:inputText value="#{c.segGruposCodigo}" style="width:100%"/>  
						</f:facet>  
					</p:cellEditor>  
				</p:column>  

				<p:column headerText="Descrição" style="width:350px">  
					<p:cellEditor>  
						<f:facet name="output">  
							<h:outputText value="#{c.segGruposDescri}" />  
						</f:facet>  
						<f:facet name="input">  
							<h:inputText value="#{c.segGruposDescri}" style="width:100%"/>  
						</f:facet>  
					</p:cellEditor>  
				</p:column>  
				<p:column headerText="Opções2">  
					<p:rowEditor />  
				</p:column>  
		    </p:dataTable>
		</h:form>
	</f:view>
</html>
This is the segGruposController:

Code: Select all

package br.com.sitic.sitic.seguranca.action;

import java.io.Serializable;
import java.util.List;

import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.persistence.EntityManager;

import javax.faces.context.FacesContext;
import br.com.sitic.sitic.seguranca.model.SegGrupos;

public class SegGruposController {
	private SegGrupos seggrupos;
	private List<SegGrupos>	lseggrupos;
	private Integer 		seggruposcodigo;
	@SuppressWarnings("rawtypes")
	private DataModel model;
	private EntityManager	em;

	public SegGruposController(){
		seggrupos = new SegGrupos();
		
	}
	
	public Integer getSeggruposcodigo() {
		return seggruposcodigo;
		
	}

	public void setSeggruposcodigo(Integer seggruposcodigo) {
		this.seggruposcodigo = seggruposcodigo;
	}
/*
	public void setLseggrupos(List<SegGrupos> lseggrupos) {
		this.lseggrupos = lseggrupos;
	}
*/
	@SuppressWarnings("unchecked")
	public List<SegGrupos> getLseggrupos(){
		SegGruposDAO seggruposdao = new SegGruposDAO();
		lseggrupos = seggruposdao.exibir();
		return lseggrupos;
	}

	public SegGrupos getSeggrupos(){
		if (seggruposcodigo != null) {
			seggrupos = em.find(SegGrupos.class, seggruposcodigo);
		}
		if (seggrupos == null) {
			seggrupos = new SegGrupos();
		}
		return seggrupos;
	}
	
	public void setSeggrupos(SegGrupos seggrupos){
		this.seggrupos = seggrupos;
	}
	
	public String adicionar() {
		seggrupos = new SegGrupos();
		return "grupossegurancaform";
	}

	public String editar() {
		seggrupos = new SegGrupos();
		return "grupossegurancaform";
	}

	public String deletar(){
		SegGruposDAO seggruposdao = new SegGruposDAO();
		seggruposdao.deletar(seggrupos);
		return "Listar";
	}

	public String salvar(){
		SegGruposDAO seggruposdao = new SegGruposDAO();
		seggruposdao.salvar(seggrupos);
		return "Listar";
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public DataModel getTodos(){
		SegGruposDAO seggruposdao = new SegGruposDAO();
		model = new ListDataModel(seggruposdao.exibir());
		return model;
	}
		
	public int getCount(){
		SegGruposDAO seggruposdao = new SegGruposDAO();
		return seggruposdao.exibir().size();
	}

}
Thanks for help.
Eclipse Helios.
JSF-2.0 (Mojarra 2.1.0-b11).
GlassFish 3.1.
PrimeFaces 2.2.1
EclipseLink 2.1.x - EclipseLink 2.1.x.
PostgreSQL 9.0

jlferreira
Posts: 43
Joined: 16 Nov 2010, 17:52

24 Nov 2010, 17:41

Anyone?
Eclipse Helios.
JSF-2.0 (Mojarra 2.1.0-b11).
GlassFish 3.1.
PrimeFaces 2.2.1
EclipseLink 2.1.x - EclipseLink 2.1.x.
PostgreSQL 9.0

ethermion
Posts: 117
Joined: 25 Aug 2010, 15:11

24 Nov 2010, 18:05

The error is in code handling an Ajax exception. Looks like nothing to do with Primefaces. Notice no Primefaces in your stack trace.

Looks like you are using Glassfish, but you don't say so, nor which version, nor which version of JSF, nor which version of Primefaces, nor which OS...

If I had to guess, the socket got closed between the server and the client. But you provide little useful info, so the best I can tell is that is has nothing to do with PF.DataTable...

Might be better off posting to a Glassfish forum - and do give them more info than you have provided here. Never seen anything like that with PF 2.1/2.2, Mojarra 2.0.2/2.0.3 and Tomcat 6/7 and TONS of datatables. Without datatables, my app is just a login screen.

-e
Mojarra 2.2.8
Primefaces 5.1
Wildfly 8.2

jlferreira
Posts: 43
Joined: 16 Nov 2010, 17:52

25 Nov 2010, 22:59

Hi all.
I changed the libs and AS that I was using and the problem persists.
I'm using:
Eclipse Helios.
Tomcat 7.0.
JSF 2.0 (Mojarra 2.0.3-FCS)
EclipseLink 2.1.x.
PrimeFaces 2.2.RC2
When I press the option icon of datatable example, the input fields appears, but when I press the confirm icon, the changes are not applied.

thanks for help.
Eclipse Helios.
JSF-2.0 (Mojarra 2.1.0-b11).
GlassFish 3.1.
PrimeFaces 2.2.1
EclipseLink 2.1.x - EclipseLink 2.1.x.
PostgreSQL 9.0

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

10 Dec 2011, 07:28

I know this is an old post, but the fix seems to make this bean ViewScoped. I see that you included Serializable, but I don't see where you made this bean Session/Request/ViewScoped. ViewScoped is recommended.

Code: Select all

package br.com.sitic.sitic.seguranca.action;

import java.io.Serializable;
import java.util.List;

import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.persistence.EntityManager;

import javax.faces.context.FacesContext;
import br.com.sitic.sitic.seguranca.model.SegGrupos;

public class SegGruposController {
   private SegGrupos seggrupos;
   private List<SegGrupos>   lseggrupos;
   private Integer       seggruposcodigo;
   @SuppressWarnings("rawtypes")
   private DataModel model;
   private EntityManager   em;

   public SegGruposController(){
      seggrupos = new SegGrupos();
      
   }
   
I stumbled across this post, because I'm experiencing the same error but for different reason; I think it may be related to the ViewExpiredException, but ViewExpiredException does not show in my log, and I already included an error page for ViewExpiredException in my web.xml.
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 60 guests