zoukankan      html  css  js  c++  java
  • javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'org

    1、错误描述

    2017-01-13 15:39:18,107 [http-apr-8080-exec-5] ERROR [core.interceptor.ExceptionResolverCustom] - HV000030: No validator could be found for constraint 'org.hibernate.validator.constraints.NotBlank' validating type 'java.lang.Integer'. Check configuration for 'stuId'
      javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'org.hibernate.validator.constraints.NotBlank' validating type 'java.lang.Integer'. Check configuration for 'stuId'
    	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.throwExceptionForNullValidator(ConstraintTree.java:229)
    	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getConstraintValidatorNoUnwrapping(ConstraintTree.java:310)
    	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getConstraintValidatorInstanceForAutomaticUnwrapping(ConstraintTree.java:244)
    	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getInitializedConstraintValidator(ConstraintTree.java:163)
    	at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:116)
    	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:620)
    	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:583)
    	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForSingleDefaultGroupElement(ValidatorImpl.java:527)
    	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:495)
    	at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:460)
    	at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:410)
    	at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:207)
    	at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:109)
    	at org.springframework.validation.DataBinder.validate(DataBinder.java:760)
    	at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.validateIfApplicable(ModelAttributeMethodProcessor.java:161)
    	at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:109)
    	at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:79)
    	at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:157)

    2、错误原因

          Java实体类中stuId是Integer类型,用了NotBlank判断不能为空,而这个注解是判断字符串是否为空

    @NotBlank(message="学号不能为空")
    private Integer stuId;

    3、解决办法

          去掉@NotBlank注解

    private Integer stuId;


        

  • 相关阅读:
    字段名删不掉
    刷新f5/ctrl+f5
    大量数据模拟
    sub_query join drupal7 view_query_alter
    测试风格的代码
    csv/excel乱码
    window.location.reload(true)的异步现象
    扫描条形码
    yield %%% generator
    batch example
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13313974.html
Copyright © 2011-2022 走看看