HV000030: No validator could be found for type: java.util.Date.

问题描述

也照着demo写了个StringToDateConverter implements Converter<String, Date>,xml也跟着配置了,bean类如下public class SearchBookableRoom {@NotBlank(message="开始日期必须指定")@Future(message="不支持当前指定的开始时间")@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")private Date beginTime;@NotBlank(message="不能为空")private String pid; @Min(value=1,message="消费时长不能低于1小时")private String timeLength;controller类加了@InitBinder //此处的参数也可以是ServletRequestDataBinder类型public void initBinder(ServletRequestDataBinder binder) throws Exception {DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");CustomDateEditor dateEditor = new CustomDateEditor(df, true);binder.registerCustomEditor(Date.class, dateEditor);}@RequestMapping(value="bookable-search",method=RequestMethod.GET)public void SearchBookableRoom(@Valid SearchBookableRoom order,BindingResult bindingResult,HttpServletRequest request,HttpServletResponse response) throws IOException{但是没次都会抛出 HV000030: No validator could be found for type: java.util.Date. 这个异常

解决方案

1、No validator could be found for type: java.util.Date 意思是没有校验器 不是转换器 看看有没有添加hibernate validator jar包2、你使用了@DateTimeFormat(pattern="yyyy-MM-dd HH:mm") 就没必要自定义类型转换器 请添加joda 相关jar包即可3、更多可参考我的博客http://jinnianshilongnian.iteye.com/blog/1733708

时间: 2025-01-08 02:31:31

HV000030: No validator could be found for type: java.util.Date.的相关文章

Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property &#039;xxx&#039;: no matching editors or conversion strategy found

今天在完成项目的时候遇到了下面的异常信息: 04-Aug-2014 15:49:27.894 SEVERE [http-apr-8080-exec-5] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [cms] in context with path [/cms] threw exception [Request processing failed; nested excep

【ActiveMQ】管理界面查看消息详情,报错/WEB-INF/tags/form/forEachMapEntry.tag PWC6199: Generated servlet error: The type java.util.Map$Entry cannot be resolved. It is

ActiveMQ版本:5.12 JDK版本:1.8 ===================== 使用ActiveMQ过程中,在管理界面查看消息详情,发现报错: 查看日志信息,报错如下: 2017-11-29 16:29:08,020 | WARN | /admin/message.jsp | org.eclipse.jetty.servlet.ServletHandler | qtp68389885-53 org.apache.jasper.JasperException: PWC6033: U

javax.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint

  使用hibernate validator出现上面的错误, 需要 注意 @NotNull 和 @NotEmpty  和@NotBlank 区别 @NotEmpty 用在集合类上面@NotBlank 用在String上面@NotNull    用在基本类型上   如果在基本类型上面用NotEmpty或者NotBlank 会出现上面的错 http://blog.csdn.net/dracotianlong/article/details/23181729 javax.validation.Une

Description Resource Path Location Type Java compiler level does not match the version of the instal

Description Resource Path Location Type Java compiler level does not match the version of the instal 解决办法 在项目上右键Properties->Project Facets,在打开的Project Facets页面中的Java下拉列表中,选择相应版本. 有可能是java1.6 改成java6之类的

no suitable HttpMessageConverter found for request type [java.lang.Integer]

今天在使用Spring Template的时候遇到了这个异常: no suitable HttpMessageConverter found for request type [java.lang.Integer] Google了一下然后在stackoverflow上面找到了解决方案: I have a method in Spring rest service. @RequestMapping(value = "test/process", method = RequestMetho

android-Value ? of type java.lang.String cannot be

问题描述 Value ? of type java.lang.String cannot be public class Register_ extends Activity{ private ProgressDialog pDialog; JSONParser jsonParser = new JSONParser(); EditText name; EditText password; Button login_button; private static String url = "htt

Could not determine type for: java.util.Collection, at table: 解决

Could not determine type for: java.util.Collection, at table: 该错误有可能的原因是:  在实体类的属性中的annotation, 要么就全写在属性上,要么就全写在get方法上,不能混用.   @Entity @SequenceGenerator(name = "Person_Seq", sequenceName = "person_seq") public class Person implements

bootstrap-BootStrap3在手机上显示效果有问题input,type=&amp;amp;quot;date&amp;amp;quot;

问题描述 BootStrap3在手机上显示效果有问题input,type="date" BootStrap3在手机上显示效果有问题input,type="date" 文字底部会被挡住,怎么解决? type="text"的就没问题

spring mvc Failed to convert property value of type java.lang.String to required

问题描述 在使用springmvc的时候,遇到一个非常痛苦的问题:Failedtoconvertpropertyvalueoftypejava.lang.Stringtorequiredtypejava.lang.Integerforpropertyorder;nestedexceptionisjava.lang.NumberFormatException:Forinputstring:"sadfas"errors.requiredgoogle了一大把,也照别人说的做了,添加prote