Hibernate4.x与spring3.x整合,有关事务的处理,用Junit4测试,出现org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txManager' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/engine/SessionFactoryImplementor;
xml主要配置信息:
com.li.bean.User com.li.bean.Log org.hibernate.dialect.MySQL5Dialect true
解决办法:并不是缺少jar包。目前spring3.x已经支持hibernate4.x。所以有些以前的hibernate3字眼改成hibernate4即可!正如
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">与
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">改成
不出现报错了!