报错:Unable to instantiate Configuration. Unable to build the default ValidatorFactory.

出处:http://blog.csdn.net/c_w_d/article/details/52199786

在使用hibernat3.6.10.Final-dist 配置hibernate.cfg.xml的时候,出现了一个问题。用junit测试的时候,抛出一个异常:
Unable to get the default Bean Validation factory
解决方案:

在hibernate.cfg.xml中配置的时候 需要这个一个属性:

<!--Disable the BeanValidation -->
<property name="javax.persistence.validation.mode">none</property>

原因分析:
javax.persistence.validation.mode默认情况下是auto(自动的)即:如果不设置的话,会自动去你的classpath下面找一个bean-validation**包,找不到,所以就会报the default Bean Validation factory找不到的错误。

猜你喜欢

转载自blog.csdn.net/jifgjifg/article/details/77922286
今日推荐