javax.servlet.ServletException:HV000030:找不到类型的验证器:java.util.Date [重复]
Posted
技术标签:
【中文标题】javax.servlet.ServletException:HV000030:找不到类型的验证器:java.util.Date [重复]【英文标题】:javax.servlet.ServletException: HV000030: No validator could be found for type: java.util.Date [duplicate] 【发布时间】:2014-11-16 16:36:13 【问题描述】:当我使用 JSF 2.1 并使用 JBoss 服务器提交表单时,出现标题异常。
我正在尝试使用和学习休眠注释。
我的实体 bean 是这样的:
@NotEmpty
@Temporal(TemporalType.DATE)
private Date date;
我收到此错误页面:
JBWEB000071: root cause
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type: java.util.Date.
org.hibernate.validator.internal.engine.ConstraintTree.verifyResolveWasUnique(ConstraintTree.java:411)
org.hibernate.validator.internal.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:392)
org.hibernate.validator.internal.engine.ConstraintTree.getInitializedValidator(ConstraintTree.java:350)
org.hibernate.validator.internal.engine.ConstraintTree.validateConstraints(ConstraintTree.java:171)
org.hibernate.validator.internal.engine.ConstraintTree.validateComposingConstraints(ConstraintTree.java:259)
org.hibernate.validator.internal.engine.ConstraintTree.validateConstraints(ConstraintTree.java:154)
org.hibernate.validator.internal.engine.ConstraintTree.validateConstraints(ConstraintTree.java:124)
org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:86)
org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyForDefaultGroup(ValidatorImpl.java:820)
org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyForCurrentGroup(ValidatorImpl.java:733)
org.hibernate.validator.internal.engine.ValidatorImpl.validateValueInContext(ValidatorImpl.java:690)
org.hibernate.validator.internal.engine.ValidatorImpl.validateValue(ValidatorImpl.java:169)
javax.faces.validator.BeanValidator.validate(BeanValidator.java:315)
javax.faces.component.UIInput.validateValue(UIInput.java:1153)
javax.faces.component.UIInput.validate(UIInput.java:971)
javax.faces.component.UIInput.executeValidate(UIInput.java:1237)
javax.faces.component.UIInput.processValidators(UIInput.java:702)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1216)
javax.faces.component.UIForm.processValidators(UIForm.java:253)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1216)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1216)
javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1164)
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
有人知道为什么吗?
谢谢,
【问题讨论】:
【参考方案1】:即使我不明白@NotEmpty
和@NotBlank
之间的相似之处,这篇文章也适合我:
Error with validator (No validator could be found for type: java.util.Date.)
问候,
编辑:
即使我在javax.servlet.ServletException: HV000030: No validator could be found for type: java.lang.Integer 收到重复问题的评论,我只想明确指出,这不仅发生在 Integers 上,而且还发生在 Dates 上,也许因为我们不知道还有多少其他类型。
我同意在使用注释之前尝试理解注释的说法,但我也说我们没有足够的文档。
【讨论】:
以上是关于javax.servlet.ServletException:HV000030:找不到类型的验证器:java.util.Date [重复]的主要内容,如果未能解决你的问题,请参考以下文章