javax.servlet.ServletException:HV000030:找不到类型的验证程序:java.util.Date

时间:2014-09-22 16:21:47

标签: hibernate jsf jboss annotations

当我使用JSF 2.1提交表单并使用JBoss服务器时,会出现标题上的异常。

我试图使用和学习hibernate注释。

我的实体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 个答案:

答案 0 :(得分:0)

即使我不理解@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得到了重复问题的评论,我只想清楚地知道这不仅发生在整数,而且还发生在日期也许对于我们 - 不知道有多少其他类型。

我同意在使用它们之前尝试理解注释的声明,但我也说我们没有足够的文档。