Boa tarde.
Estou fazendo meu primeiro teste de jsf2 com primefaces e estou tendo o seguinte Exception:
WARNING: JSF1063: AVISO! Definindo valor de atributo não serializável em HttpSession (chave: extratoMB, classe do valor: br.com.voip.mbeans.ExtratoMB).
SEVERE: javax.faces.FacesException: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.sun.faces.application.view.StateHolderSaver
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1256)
at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:672)
at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:284)
at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:131)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:430)
at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:288)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
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)
Caused by: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.sun.faces.application.view.StateHolderSaver
at com.sun.faces.application.view.StateManagementStrategyImpl$4.invokeContextCallback(StateManagementStrategyImpl.java:288)
at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1253)
... 36 more
Isto ocorre na action que submete duas datas no codigo abaixo:
<h:form prependId="false">
<h1>Extrato</h1>
Cliente: #{loginMB.ccCard.firstname} #{loginMB.ccCard.lastname}
<br/>
Data Inicial: <p:calendar value="#{extratoMB.dtInicio}" size="10" showOn="button" />
Data Final: <p:calendar value="#{extratoMB.dtFim}" size="10" showOn="button"/>
<h:commandButton value="Consultar" action="#{extratoMB.consultar}" />
</h:form>
@ManagedBean
@SessionScoped
public class ExtratoMB {
@PersistenceContext
EntityManager em;
@Resource
private UserTransaction utx;
private Date dtInicio;
private Date dtFim;
/** Creates a new instance of LoginMB */
public ExtratoMB() {
}
public String consultar() {
System.out.println(dtInicio);
System.out.println(dtFim);
return "extrato";
}
/**
* @return the dtInicio
*/
public Date getDtInicio() {
return dtInicio;
}
/**
* @param dtInicio the dtInicio to set
*/
public void setDtInicio(Date dtInicio) {
this.dtInicio = dtInicio;
}
/**
* @return the dtFim
*/
public Date getDtFim() {
return dtFim;
}
/**
* @param dtFim the dtFim to set
*/
public void setDtFim(Date dtFim) {
this.dtFim = dtFim;
}
}
Para usar o primefaces tem que fazer alguma configuração extra?