Erro ao tentar cadastrar usuário, aparece a seguinte mensagem:
accordion:dtNasc: '22-02-1990' could not be understood as a date.
XHTML:
<p:outputLabel class="lt" value="Data de Nascimento:" /> <p:calendar id="dtNasc" value="#{usuarioBean.funcionario.dt_nasc}" locale="pt" yearRange="-99:+39" widgetVar="dtNasc"navigator="true" showButtonPanel="true"> <f:convertDateTime pattern="dd/MM/yyyy" /> </p:calendar>
could not be understood as a date.
Traduzindo: Não pode ser traduzido como data.
22-02-1990 e 22/02/1990 são padrões diferentes. Altere seu pattern para pattern=“dd-MM-yyyy” e faça o teste. Para mais informações leia sobre a classe SimpleDateFormat
Alterei, mas agora aparece esse erro:
Caused by: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.CharSequence
poderia postar o stacktrace do erro?
javax.validation.ValidationException: HV000028: Unexpected exception during isValid call.
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:451)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:127)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateComposingConstraints(ConstraintTree.java:398)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:98)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:87)
at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:73)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:592)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:555)
at org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyForDefaultGroup(ValidatorImpl.java:1008)
at org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyForCurrentGroup(ValidatorImpl.java:924)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateValueInContext(ValidatorImpl.java:875)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateValue(ValidatorImpl.java:238)
at javax.faces.validator.BeanValidator.validate(BeanValidator.java:315)
at javax.faces.component.UIInput.validateValue(UIInput.java:1164)
at javax.faces.component.UIInput.validate(UIInput.java:982)
at org.primefaces.component.calendar.Calendar.validate(Calendar.java:483)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1248)
at javax.faces.component.UIInput.processValidators(UIInput.java:712)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1260)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1260)
at org.primefaces.util.ComponentUtils.processValidatorsOfFacetsAndChilds(ComponentUtils.java:266)
at org.primefaces.component.api.UITabPanel.processValidators(UITabPanel.java:1073)
at javax.faces.component.UIForm.processValidators(UIForm.java:253)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1260)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1260)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.CharSequence
at org.hibernate.validator.internal.constraintvalidators.bv.size.SizeValidatorForCharSequence.isValid(SizeValidatorForCharSequence.java:23)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:448)
… 50 more
Caused by: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.CharSequence
at
org.hibernate.validator.internal.constraintvalidators.bv.size.SizeValidatorForCharSequence.isValid(SizeValidatorForCharSequence.java:23)
Verifique as configurações do seu banco de dados e do Hibernate pois o seu JSF está instanciando um Date com sucesso.
as configurações do hibernate e banco estão corretos… não entendi!