2014-09-22 58 views
0

當我使用JSF 2.1提交表單並使用JBoss服務器時,出現標題異常。javax.servlet.ServletException:HV000030:找不到可用於類型爲java.util.Date的驗證程序

我想使用和學習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) 

是否有人知道這是爲什麼?

謝謝

回答

0

即使我不明白@NotEmpty@NotBlank之間的相似性,這個帖子對我的作品:

Error with validator (No validator could be found for type: java.util.Date.)

問候,

編輯:

即使我g在javax.servlet.ServletException: HV000030: No validator could be found for type: java.lang.Integer的重複問題的註釋我只是想明確說明,這不僅發生在整數,而且還與日期,也許我們不知道有多少其他類型。

我同意在使用它們之前試圖理解註釋的說法,但我也說我們沒有足夠的文檔來解決這個問題。

相關問題