java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CourseDAO' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required

Caused by: java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
at org.springframework.orm.hibernate3.support.HibernateDaoSupport.checkDaoConfig(HibernateDaoSupport.java:118)
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 26 more

由于我使用的是spring的annotation注入,HibernateDaoSupport不能注入sessionFactiry和hibernateTemplemet。

解决方法:

@Resource
   public void setSessionFactory0(SessionFactory sessionFactory){  
      super.setSessionFactory(sessionFactory);  
   }

 

java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required的更多相关文章

  1. SSH框架环境搭建问题:java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required

    SSH框架启动tomcate时出错 严重: Exception sending context initialized event to listener instance of class org. ...

  2. java.lang.IllegalArgumentException: id to load is required for loading

    java.lang.IllegalArgumentException: id to load is required for loading at org.hibernate.event.LoadEv ...

  3. Caused by: java.lang.IllegalArgumentException: 'dataSource' or 'jdbcTemplate' is required

    概述 看到异常 一般就知道 在使用JdbcTemplate 需要购入数据源, 购入数据源的方式有两种,一种是xml 配置 在DAO层注入数据源, 另一种是在xml 中 配置模版JdbcTemplate ...

  4. Hibernate整合Spring异常'sessionFactory' or 'hibernateTemplate' is required

    今日在写GenericDao时,发现了一个异常,内容如下: org.springframework.beans.factory.BeanCreationException: Error creatin ...

  5. spring注解方式,异常 'sessionFactory' or 'hibernateTemplate' is required的解决方法

    做单元测试的时候,抛出异常 Caused by: java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' ...

  6. spring boot :error querying database. Cause: java.lang.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required

    配置多个数据源启动报错,error querying database. Cause: java.lang.IllegalArgumentException: dataSource or dataSo ...

  7. MyBatis与Spring MVC结合时,使用DAO注入出现:Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

    错误源自使用了这个例子:http://www.yihaomen.com/article/java/336.htm,如果运行时会出现如下错误: Invocation of init method fai ...

  8. Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required [ IDEA mybatis项目报错 ]

    今天笔者用Springboot框架整合Mybatis做一个小小的项目: 代码写完,在运行项目时,IDEA给我报了3处错误: org.springframework.beans.factory.Unsa ...

  9. springboot整合mybatis的时候报错Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required

    今天闲来无事,学习springboot整合mybatis,在bilibili看视频学的,视频中在dao层的interface上面加上org.apache.ibatis.annotations.Mapp ...

随机推荐

  1. Myeclipse反编译插件的安装

    1.首先需要下载 jad.exe 和 jadClipse.jar 2.找到myeclipse的安装路径会有两个文件夹 3.需要新建一下文件夹 看准路径和jad.exe的位置 4.配置jadClipse ...

  2. CVE-2010-3654分析及利用

    三年前分析的一个漏洞,最近又温习一遍,这个flash中混淆漏洞的鼻祖,10年最经典的漏洞. 漏洞触发原因 该漏洞主要因为avm对返回的类没有进行校验,通过修改swf文件,实现Ref类和Origin类的 ...

  3. nefu1109 游戏争霸赛(状压dp)

    题目链接:http://acm.nefu.edu.cn/JudgeOnline/problemShow.php?problem_id=1109 //我们校赛的一个题,状压dp,还在的人用1表示,被淘汰 ...

  4. JAVA基础研究

    package Test; public class L3_1 { public static void main(String[] args) { C c1=new C(100); C c2=new ...

  5. ViewPager+Fragment取消预加载(延迟加载)(转)

    原文:http://www.2cto.com/kf/201501/368954.html 在项目中,都或多或少地使用的Tab布局,所以大都会用到ViewPager+Fragment,但是Fragmen ...

  6. Arc GIS engine10.2与VS2012的安装及匹配步骤

      本文章已收录于:   .embody { padding: 10px 10px 10px; margin: 0 -20px; border-bottom: solid 1px #ededed } ...

  7. iis下搭建通过phpstudy集成的环境,phpmyadmin导入数据库无法应解决办法

    本人非常喜欢phpstudy的集成php+mysql环境,一键搞定,但是不知道为什么搭建的phpmyadmin的数据库管理器,无法上传,点击无反应 发现上传数据的界面有点不同 正常情况下是这样的: 非 ...

  8. python常用模块json、os、sys

    一.序列化 json & pickle 模块 json--用于字符串和Python数据类型间进行转换 pickle---用于python特有的类型和Python的数据类型间进行转换 json: ...

  9. 德国W家HIPP 奶粉有货播报:2014.6.25 HIPP 1+ 4盒装有货啦!

    德国W家HIPP 奶粉有货播报:2014.6.25 HIPP 1+ 4盒装有货啦!

  10. 基于java平台的常用资源整理

    这里整理了基于java平台的常用资源 翻译 from :akullpp | awesome-java 大家一起学习,共同进步. 如果大家觉得有用,就mark一下,赞一下,或评论一下,让更多的人知道.t ...