spring与hibernate整合然后出现如下错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory
Caused by: org.hibernate.HibernateException: Unable to get the default Bean Validation factory
Caused by: java.lang.reflect.InvocationTargetException
Caused by: org.hibernate.HibernateException: Unable to build the default ValidatorFactory
Caused by: javax.validation.ValidationException: Unable to instantiate Configuration.
Caused by: java.lang.NullPointerException

分析错误原因就是编译器无法识别和找到bean的validate包,但是,这个包确实存在的,然后根据查询发现hibernate有一个属性javax.persistence.validation.mode,这个属性默认是auto的,但是这样的话,编译器就无法识别了,所以需要我们手动设置一下,所以找到你的hibernate.cfg.xml文件,将这个属性加入进去。

<property name="javax.persistence.validation.mode">none</property>

加入后上述问题全部没有了,写的测试类,就好使了。

希望犯愁的小伙伴可以解决这个问题,多谢您的支持,没事请点赞!!!

Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable t的更多相关文章

  1. Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; neste

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto ...

  2. aused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method fai

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleDaoImpl' ...

  3. MyBatis笔记----报错:Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/ij34/mybatis/applicationContext.xml]: Invocation of init method failed; nested exception is org.sp

    四月 05, 2017 4:51:02 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRef ...

  4. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined ...

  5. Error creating bean with name 'mapper' defined in class path resource [applicationcontext.xml]: Cannot resolve reference to bean 'factory' while setting bean property 'sqlSessionFactory'; nested excep

    Error creating bean with name 'mapper' defined in class path resource [applicationcontext.xml]: Cann ...

  6. 报错org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [bean.xml]

    报这种错的原因基本上是applicationContext.xml文件中bean配置错误,错误如下: org.springframework.beans.factory.BeanCreationExc ...

  7. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [bean.xml]: Invocation of init method failed; nested exception is

    在复制xml文件进行修改的时候,我经常将不小心对原文件进行修改,而导致创建bean出错.报错如下所示: Exception sending context initialized event to l ...

  8. 使用SpringMVC报错 Error creating bean with name 'conversionService' defined in class path resource [springmvc.xml]

    使用SpringMVC报错 Error creating bean with name 'conversionService' defined in class path resource [spri ...

  9. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deptDao_a' defined in class path resource [beansAndHibernate.xml]: Cannot resolve reference to bean 'sessionFact

    Error creating bean with name 'deptDao_a' defined in class path 因为更改了类的名字,所以其setter方法没有更改,需要 private ...

随机推荐

  1. as3 连接mysql

    http://www.cnblogs.com/yili16438/archive/2011/04/23/2025936.html

  2. jboss 异常处理

    异常: jboss.aop:service=AspectManager 15:19:46,361 ERROR [ScannerThread] [MainDeployer] org.jboss.depl ...

  3. C#--Winform项目核心模块--考勤模块

    C#--Winform项目核心模块--考勤模块(一) C#--Winform项目核心--考勤模块(二) C#--Winform项目核心模块--考勤模块(三)

  4. ios 给图片加文字

    - (UIImage*) drawText:(NSString*)text inImage:(UIImage*)image { //prepare image context UIGraphicsBe ...

  5. ComputeSignature 中行支付签名报错(win7 64位系统)

    在做中行加密验签的时候出现的问题.原本在XP系统下可以正常运行的,现在换了win7 64位系统就出现了这个问题,没头绪 所以发上来求各位大大支招 有什么好的解决方案.. 我的解决办法: 1.C:\Do ...

  6. break、continue、pass介绍

    break.continue.pass介绍 break:跳出当前循环 continue:跳出本次循环,进行下一次循环 pass:什么也不做,占位.

  7. 大型运输行业实战_day05_1_登录+注销+表单重复提交+登录拦截器

    1.登录 登录实现如下步骤: 1.在首页中添加登录按钮 html代码如下: <%@ page contentType="text/html;charset=UTF-8" la ...

  8. 大型运输行业实战_day03_2_使用ajax将请求页面与请求数据分离

    1.引入jquery 1.添加jquery包 2.在要使用jquery的页面中引入jquery 引入jquery后必须检查是否引入正确,这里值得注意的是 springMVC默认情况先会拦截 js文件, ...

  9. webdriver屏幕截图(python)

    webdriver对当前页面进行截图,截取的是当前页面的全图,不论页面有多长,有两种截图方法 1.get_screenshot_as_file(XXX) 2.save_screenshot(XXX) ...

  10. 一些常用的c++系统函数

    数学<cmath><math.h>: 1 三角函数 double sin (double); double cos (double); double tan (double); ...