error: No validator could be found for type: java.time.LocalDate -


i'm working on project uses bean validation (hibernate validator 5.1.3.final). bean has attribute @past annotation.

@past(message = "a data deve estar no passado.") private localdate dataabertura; 

but, when validation occurs following exception:

21:46:12,424 error [io.undertow.request] (default task-35) ut005023: exception handling request /financeiro/clientes/pessoafisica: javax.servlet.servletexception: javax.validation.unexpectedtypeexception: hv000030: no validator found type: java.time.localdate.     @ br.com.caelum.vraptor.vraptor.dofilter(vraptor.java:127) [vraptor-4.1.4.jar:]     @ io.undertow.servlet.core.managedfilter.dofilter(managedfilter.java:60) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.filterhandler$filterchainimpl.dofilter(filterhandler.java:132) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.filterhandler.handlerequest(filterhandler.java:85) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.security.servletsecurityrolehandler.handlerequest(servletsecurityrolehandler.java:61) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.servletdispatchinghandler.handlerequest(servletdispatchinghandler.java:36) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ org.wildfly.extension.undertow.security.securitycontextassociationhandler.handlerequest(securitycontextassociationhandler.java:78)     @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43) [undertow-core-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.security.sslinformationassociationhandler.handlerequest(sslinformationassociationhandler.java:131) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.security.servletauthenticationcallhandler.handlerequest(servletauthenticationcallhandler.java:56) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43) [undertow-core-1.1.0.final.jar:1.1.0.final]     @ io.undertow.security.handlers.abstractconfidentialityhandler.handlerequest(abstractconfidentialityhandler.java:45) [undertow-core-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.security.servletconfidentialityconstrainthandler.handlerequest(servletconfidentialityconstrainthandler.java:63) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.security.handlers.authenticationmechanismshandler.handlerequest(authenticationmechanismshandler.java:58) [undertow-core-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.security.cachedauthenticatedsessionhandler.handlerequest(cachedauthenticatedsessionhandler.java:70) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.security.handlers.securityinitialhandler.handlerequest(securityinitialhandler.java:76) [undertow-core-1.1.0.final.jar:1.1.0.final]     @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43) [undertow-core-1.1.0.final.jar:1.1.0.final]     @ org.wildfly.extension.undertow.security.jacc.jacccontextidhandler.handlerequest(jacccontextidhandler.java:61)     @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43) [undertow-core-1.1.0.final.jar:1.1.0.final]     @ io.undertow.server.handlers.predicatehandler.handlerequest(predicatehandler.java:43) [undertow-core-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.servletinitialhandler.handlefirstrequest(servletinitialhandler.java:261) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.servletinitialhandler.dispatchrequest(servletinitialhandler.java:247) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.servletinitialhandler.access$000(servletinitialhandler.java:76) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.servlet.handlers.servletinitialhandler$1.handlerequest(servletinitialhandler.java:166) [undertow-servlet-1.1.0.final.jar:1.1.0.final]     @ io.undertow.server.connectors.executeroothandler(connectors.java:197) [undertow-core-1.1.0.final.jar:1.1.0.final]     @ io.undertow.server.httpserverexchange$1.run(httpserverexchange.java:759) [undertow-core-1.1.0.final.jar:1.1.0.final]     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) [rt.jar:1.8.0_25]     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) [rt.jar:1.8.0_25]     @ java.lang.thread.run(thread.java:745) [rt.jar:1.8.0_25] caused by: javax.validation.unexpectedtypeexception: hv000030: no validator found type: java.time.localdate.     @ org.hibernate.validator.internal.engine.constraintvalidation.constraintvalidatormanager.verifyresolvewasunique(constraintvalidatormanager.java:218) [hibernate-validator-5.1.3.final.jar:5.1.3.final]     @ org.hibernate.validator.internal.engine.constraintvalidation.constraintvalidatormanager.findmatchingvalidatorclass(constraintvalidatormanager.java:193) [hibernate-validator-5.1.3.final.jar:5.1.3.final]     @ org.hibernate.validator.internal.engine.constraintvalidation.constraintvalidatormanager.getinitializedvalidator(constraintvalidatormanager.java:97) [hibernate-validator-5.1.3.final.jar:5.1.3.final]     @ org.hibernate.validator.internal.engine.constraintvalidation.constrainttree.validateconstraints(constrainttree.java:125) [hibernate-validator-5.1.3.final.jar:5.1.3.final] 

what's wrong? hibernate validator doesn't support localdate?

actually issue refer hv-874. hibernate validator 5.2.x add support of new java 8 date/time types. should stress "some" in context. in particular localdate not supported. javadocs of localdate says:

this class not store or represent time or time-zone. instead, description of date, used birthdays. cannot represent instant on time-line without additional information such offset or time-zone.

without instant on timeline not possible if given date in part or future. first attaching timezone possible state , answer question.

if still think makes sense in use case use past , @future constraints localdate can implement own constraintvalidator localdate , register via xml using constraint-definition element in constraint mapping file seen here.

if using hibernate validator 5.2, can use java serviceloader approach register additional constraintvalidator implementations - see constraintdefinitioncontributor. latter hibernate validator specific feature.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -