Validation异常:No validator could be found for constraint ‘.....‘ validating type ‘java.lang.Integer‘.

 


 
 
  1. javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'javax.validation.constraints.Pattern' validating type 'java.lang.Integer'. Check configuration for 'sortType'
  2. at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.throwExceptionForNullValidator(ConstraintTree.java: 227) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  3. at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getConstraintValidatorNoUnwrapping(ConstraintTree.java: 308) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  4. at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getConstraintValidatorInstanceForAutomaticUnwrapping(ConstraintTree.java: 242) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  5. at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getInitializedConstraintValidator(ConstraintTree.java: 163) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  6. at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java: 116) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  7. at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java: 87) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  8. at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java: 73) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  9. at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java: 616) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  10. at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java: 581) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  11. at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForSingleDefaultGroupElement(ValidatorImpl.java: 527) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  12. at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java: 495) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  13. at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java: 460) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  14. at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java: 410) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  15. at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java: 207) ~[hibernate-validator- 5.4.1.Final.jar: 5.4.1.Final]
  16. at com.sf.ioms.common.utils.ValidateUtil.validateModel(ValidateUtil.java: 36) ~[ioms-common- 1.0.0.jar:?]
  17. at com.sf.ioms.api.support.AcceptDataProcessor.processData(AcceptDataProcessor.java: 37) [ioms-api-service- 0.0.1-SNAPSHOT.jar:?]
  18. at com.sf.ioms.api.web.controller.AcceptDataController.process(AcceptDataController.java: 63) [classes/:?]
  19. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?: 1.8.0_172]
  20. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 62) ~[?: 1.8.0_172]
  21. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 43) ~[?: 1.8.0_172]
  22. at java.lang.reflect.Method.invoke(Method.java: 498) ~[?: 1.8.0_172]
  23. at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java: 205) [spring-web- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  24. at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java: 133) [spring-web- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  25. at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java: 97) [spring-webmvc- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  26. at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java: 827) [spring-webmvc- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  27. at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java: 738) [spring-webmvc- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  28. at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java: 85) [spring-webmvc- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  29. at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java: 967) [spring-webmvc- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  30. at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java: 901) [spring-webmvc- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  31. at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java: 970) [spring-webmvc- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  32. at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java: 872) [spring-webmvc- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  33. at javax.servlet.http.HttpServlet.service(HttpServlet.java: 707) [javax.servlet-api- 3.1.0.jar: 3.1.0]
  34. at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java: 846) [spring-webmvc- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  35. at javax.servlet.http.HttpServlet.service(HttpServlet.java: 790) [javax.servlet-api- 3.1.0.jar: 3.1.0]
  36. at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java: 800) [jetty-servlet- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  37. at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java: 1669) [jetty-servlet- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  38. at com.sf.ioms.api.web.filter.XSSFilter.doFilter(XSSFilter.java: 37) [classes/:?]
  39. at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java: 1652) [jetty-servlet- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  40. at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java: 197) [spring-web- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  41. at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 107) [spring-web- 4.3.15.RELEASE.jar: 4.3.15.RELEASE]
  42. at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java: 1652) [jetty-servlet- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  43. at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java: 585) [jetty-servlet- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  44. at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java: 143) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  45. at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java: 577) [jetty-security- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  46. at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java: 223) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  47. at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java: 1127) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  48. at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java: 515) [jetty-servlet- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  49. at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java: 185) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  50. at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java: 1061) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  51. at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java: 141) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  52. at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java: 215) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  53. at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java: 110) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  54. at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java: 97) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  55. at org.eclipse.jetty.server.Server.handle(Server.java: 497) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  56. at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java: 310) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  57. at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java: 245) [jetty-server- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  58. at org.eclipse.jetty.io.AbstractConnection$ 2.run(AbstractConnection.java: 540) [jetty-io- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  59. at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java: 635) [jetty-util- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  60. at org.eclipse.jetty.util.thread.QueuedThreadPool$ 3.run(QueuedThreadPool.java: 555) [jetty-util- 9.2.7.v20150116.jar: 9.2.7.v20150116]
  61. at java.lang.Thread.run(Thread.java: 748) [?: 1.8.0_172]

异常原因:项目中使用的校验注解所支持的数据类型与实体中字段的类型不符合。

例:在Integer类型的字段上使用@NotEmpty,@NotEmpty支持的是字符串类型字段,这样子使用肯定是会报错的。

解决方法:换个校验注解,或者不使用校验注解

例: 将Integer类型的字段上使用的@NotEmpty换成@NotNull

希望此文能够帮助到您! 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值