今日在写GenericDao时,发现了一个异常,内容如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'genericDao' defined in class path resource [spring.common.xml]: Invocation of init method failed; nested exception is java.lang.Ille…
java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.facto…
这种情况就是在通过spring配置hibernate4的时候(注意,这里是hibernate4不是hibernate3,hibernate3的),使用的是HibernateDaoSupport的这种方式: public class BaseDao extends HibernateDaoSupport{ ***** } 类似这种方式,然后在applicationContext.xml配置为: *** <!-- 配置 SessionFactory --> <bean id="se…
首先遇到的问题就是HibernateDaoSupport引起的,程序中所有的DAO都继承自HibernateDaoSupport,而HibernateDaoSupport需要注入sessionfactory或者hibernateTemplate,所以出现"sessionFactory " or "hibernateTemplate " is required异常,但是在spring配置文件中加入sessionFactory的bean配置以后,仍然出现异常.后来看了网…
SSH框架启动tomcate时出错 严重: 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 'loginservice…
做单元测试的时候,抛出异常 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…
网上都是说在dao中未注入  sessionFactory,然而我有 于是排除 @Autowired public FlightDaoImpl(@Qualifier(value = "sessionFactory")SessionFactory sessionFactory){ //注入 sessionFactory this.setSessionFactory(sessionFactory); } 一直报这个错后来发现是 default-autowire="byName&q…
<beans    xmlns="http://www.springframework.org/schema/beans"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xmlns:aop="http://www.springframework.org/schema/aop"     xmlns:tx="http://www.springframewo…
在接触HibernateTemplate之前,我们知道,在对数据库进行CRUD操作之前,需要开启session.transaction等等.在hibernate学习过程中,我们知道了,得到session之前,需要先得到SessionFactory,进而从SessionFactory里面openSession(),或者getCurrentSession(),接着开启一transaction,然后进行对数据库的操作,在操作结束后,提交事务,关闭session.当然如果session是通过getCur…
spring+hibernate出错小结: (1)java.lang.NoClassDefFoundError: org/hibernate/context/CurrentSessionContext 原因:出现这错误时,请更改hibernate的包,更新至最新或3.1以上 (2)java.lang.NoClassDefFoundError: javax/transaction/TransactionManager 原因:缺少jta.jar 或者是找不到hbm.xml文件导致sessionfac…