Validation异常:No validator could be found for constraint '.....' validating type 'java.lang.Integer'.
-
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Pattern' validating type 'java.lang.Integer'. Check configuration for 'sortType'
-
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.throwExceptionForNullValidator(ConstraintTree.java:227) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getConstraintValidatorNoUnwrapping(ConstraintTree.java:308) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getConstraintValidatorInstanceForAutomaticUnwrapping(ConstraintTree.java:242) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getInitializedConstraintValidator(ConstraintTree.java:163) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:116) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:87) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:73) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:616) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:581) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForSingleDefaultGroupElement(ValidatorImpl.java:527) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:495) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:460) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:410) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:207) ~[hibernate-validator-5.4.1.Final.jar:5.4.1.Final]
-
at com.sf.ioms.common.utils.ValidateUtil.validateModel(ValidateUtil.java:36) ~[ioms-common-1.0.0.jar:?]
-
at com.sf.ioms.api.support.AcceptDataProcessor.processData(AcceptDataProcessor.java:37) [ioms-api-service-0.0.1-SNAPSHOT.jar:?]
-
at com.sf.ioms.api.web.controller.AcceptDataController.process(AcceptDataController.java:63) [classes/:?]
-
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_172]
-
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_172]
-
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_172]
-
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_172]
-
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) [spring-web-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) [spring-web-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) [spring-webmvc-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) [spring-webmvc-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) [spring-webmvc-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) [spring-webmvc-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) [spring-webmvc-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) [spring-webmvc-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [javax.servlet-api-3.1.0.jar:3.1.0]
-
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0]
-
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:800) [jetty-servlet-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) [jetty-servlet-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at com.sf.ioms.api.web.filter.XSSFilter.doFilter(XSSFilter.java:37) [classes/:?]
-
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.15.RELEASE.jar:4.3.15.RELEASE]
-
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) [jetty-servlet-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [jetty-servlet-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) [jetty-security-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [jetty-servlet-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.Server.handle(Server.java:497) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:245) [jetty-server-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [jetty-io-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [jetty-util-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [jetty-util-9.2.7.v20150116.jar:9.2.7.v20150116]
-
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]
异常原因:项目中使用的校验注解所支持的数据类型与实体中字段的类型不符合。
例:在Integer类型的字段上使用@NotEmpty,@NotEmpty支持的是字符串类型字段,这样子使用肯定是会报错的。
解决方法:换个校验注解,或者不使用校验注解
例: 将Integer类型的字段上使用的@NotEmpty换成@NotNull
希望此文能够帮助到您!
原文地址:https://blog.csdn.net/king_qc/article/details/81390396
Validation异常:No validator could be found for constraint '.....' validating type 'java.lang.Integer'.的更多相关文章
- org.hibernate.validator.constraints.NotBlank' validating type 'java.lang.Integer
使用hibernate时,在save方法时,报了:org.hibernate.validator.constraints.NotBlank' validating type 'java.lang.In ...
- HV000030: No validator could be found for type: java.lang.Integer.
在写接口时,一般去查找在类的Integer属性上加了不属于整型的校验,比如@NotEmpty,@Length等 @JSONField(name = "deviceNum") @No ...
- RestTemplate异常no suitable HttpMessageConverter found for request type [java.lang.Integer]
GET方式,参数必须放在URL后面,http://xxx/list?name={name}&age={age} package com.chelizi.xiruo.xframework.uti ...
- javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Size' validating type 'java.util.Date'.
开始是 javax.validation.UnexpectedTypeException: No validator could be found for type: java.lang.Intege ...
- 异常:failed for object com.sdu.crm.pojo.Customer@136a986 [java.lang.NullPointerException]
异常: failed for object com.sdu.crm.pojo.Customer@136a986 [java.lang.NullPointerException] 大家好,如果大家看到了 ...
- Java 异常 Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date'
查询时发送给服务器的日期的字符串格式:yyyy-MM-dd HH:mm:ss 服务器接收到日期的字符串之后,向 MySQL 数据库发起查询时,因为没有指定日期时间格式,导致字符串数据不能正确地转换为日 ...
- hibernate.validator.constraints.NotEmpty校验请求参数报错java.lang.NoClassDefFoundError: javax/el/PropertyNotFoundException
spring maven项目,使用hibernate validator 注解形式校验客户端的请求参数. hibernate-validator版本:5.0.2.Final validation-ap ...
- Android异常:唤醒锁未授权。(Caused by: java.lang.SecurityException: Neither user 10044 nor current process has android.permission.WAKE_LOCK.)
Android异常:Caused by: java.lang.SecurityException: Neither user 10044 nor current process has android ...
- 34 异常机制 异常体系结构 Java把异常当做对象来处理 并定义一个基类java.lang.Throwable作为所有异常的超类 Error Exception
异常体系结构 概念 Java把异常当做对象来处理,并定义一个基类java.lang.Throwable作为所有异常的超类. 在Java API中已经定义了许多异常类,这些异常类分为两大类,错误Erro ...
随机推荐
- 汇总下几个IP计算/转换的shell小脚本-转
原文:http://blog.chinaunix.net/uid-20788470-id-1841646.html 1. IP转换为整数> vi ip2num.sh#!/bin/bash# ...
- Chrome 地址栏如何设置显示 http/https 和 www
首先在 chrome 地址栏输入以下地址 chrome://flags/#omnibox-ui-hide-steady-state-url-scheme-and-subdomains 然后使用 Ctr ...
- HDFS命名空间管理
- h5文件简介
h5文件是层次格式的第5代版本,用于存储科学数据的一种文件格式和库文件,由美国超级计算中心与应用中心研发的文件格式,用以存储和组织大规模数据. H5将文件结构简化成两个主要的对象类型: 1 数据集da ...
- PHP与RBAC设计思路讲解与源码
在说权限管理前,应该先知道权限管理要有哪些功能: (1).用户只能访问,指定的控制器,指定的方法 (2).用户可以存在于多个用户组里 (3).用户组可以选择,指定的控制器,指定的方法 (4).可以添加 ...
- char类型和int类型之间的转换
在视屏课程第二章里,我们已经学习了一些常用的数据类型转换.然而,有一些时候我们会经常会遇到将char类型转换成int类型,或者需要将int类型转换为char类型的情况. 这里,我们来探讨一下这种不常用 ...
- LintCode_114 不同的路径,115 不同的路径 II
题目 有一个机器人的位于一个M×N个网格左上角(下图中标记为'Start'). 机器人每一时刻只能向下或者向右移动一步.机器人试图达到网格的右下角(下图中标记为'Finish'). 问有多少条不同的路 ...
- mysql 常用命令语法
登录到mysql client 以windows下为例,打开cmd命令窗口,进入到mysql安装目录bin目录下,首先要启动mysql服务,执行命令: net start mysql,这里不需要分号. ...
- MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; // 转换成多部分request异常
原来是需要在springmvc中配置 <!-- multipartResolver上传文件 --> <bean id="multipartResolver" cl ...
- ES6中async和await说明和用法
昨天看了一篇vue的教程,作者用async/ await来发送异步请求,从服务端获取数据,代码很简洁,同时async/await 已经被标准化,是时候学习一下了. 先说一下async的用法,它作为一个 ...