spring hiberante 集成出现异常 java.lang.ClassNotFoundException: org.hibernate.engine.SessionFactoryImplementor
出现如题的异常是由于hibernate和spring集成时的的版本不一致所导致。
如下面,所示,如果你用的hibneate 4.0及以上版本,那么将会报错,因为这里用的事务管理是hibernate 3.并非缺少什么jar包。
org.springframework.orm.hibernate3.HibernateTransactionManager
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
"> <!-- 配置一个SessionFactory,使用我们自己写的工具类来获取SessionFactory -->
<bean id="mysessionFactory" class="com.amos.spring.dao.HibernateUtil" factory-method="getFactory">
</bean>
<!-- 配置一个使用HiberanteTemplate对象 -->
<bean id="myTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="mysessionFactory"></property>
</bean>
<!-- 配置一个使用hibernateTemplate的dao-->
<bean id="accountDao" class="com.amos.spring.dao.AccountDaoByHibernateTemplate">
<property name="template" ref="myTemplate"></property>
</bean>
<bean id="transferService" class="com.amos.spring.service.TransferServiceImpl2">
<property name="accountDao" ref="accountDao"></property>
</bean> <!-- 配置事务管理 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<!-- 事务管理器作用于哪个SessionFactory -->
<property name="sessionFactory" ref="mysessionFactory"></property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>
spring hiberante 集成出现异常 java.lang.ClassNotFoundException: org.hibernate.engine.SessionFactoryImplementor的更多相关文章
- java.lang.ClassNotFoundException: org.hibernate.engine.SessionFactoryImplementor
Hibernate4.x与spring3.x整合,有关事务的处理,用Junit4测试,出现org.springframework.beans.factory.BeanCreationException ...
- java.lang.ClassNotFoundException: org.hibernate.engine.FilterDefinition的解决方案
今天在GitHub上面看到一个有意思的项目,下载下来,使用tomcat部署失败,出现异常,网上说JDK版本太高,改低,还是失败. 由于本人有个习惯,更喜欢把项目直接放入tomcat webapps 里 ...
- Caused by: java.lang.ClassNotFoundException: org.hibernate.engine.FilterDefinition
1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help ...
- spring异常 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet
spring异常 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderServlet 情况 ...
- Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.MetadataPro
1.错误描述 信息: MLog clients using java 1.4+ standard logging. 2014-7-12 19:29:20 com.mchange.v2.c3p0.C3P ...
- java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.MetadataProvider
Caused by: java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvi ...
- Caused by: java.lang.ClassNotFoundException: org.hibernate.service.jta.platform.spi.JtaPlatform
1.错误描述 2014-7-12 22:08:01 org.hibernate.tool.hbm2ddl.SchemaUpdate execute INFO: HHH000232: Schema up ...
- java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence 解决方法
编译遇到错误,如下: May 11, 2017 1:49:42 PM org.springframework.web.context.ContextLoader initWebApplicationC ...
- Caused by: java.lang.NoSuchMethodError: org.hibernate.engine.spi.SessionFactoryImplementor.getProperties()Ljava/util/Properties;
报错信息 Error starting ApplicationContext. To display the auto-configuration report re-run your applica ...
随机推荐
- jquery ajax 的 $.get()用法详解
js文件 $(document).ready(function(){ $("form").submit(function(event) {event.preventDefault( ...
- 理解SVG图片标签的viewport、viewBox、preserveAspectRatio缩放
一.viewport 表示SVG可见区域的大小,或者可以想象成舞台大小,画布大小. <svg width="></svg> 上面的SVG代码定义了一个视区,宽500单 ...
- printf()详解之终极无惑
1.printf()简介 printf()是C语言标准库函数,用于将格式化后的字符串输出到标准输出.标准输出,即标准输出文件,对应终端的屏幕.printf()申明于头文件stdio.h. 函数原型: ...
- Java对象的序列化和反序列化源码阅读
前言 序列化和反序列化看起来用的不多,但用起来就很关键,因为稍一不注意就会出现问题.序列化的应用场景在哪里?当然是数据存储和传输.比如缓存,需要将对象复刻到硬盘存储,即使断电也可以重新反序列化恢复.下 ...
- 转: xshell远程连接自动断开的问题解决办法
转:http://blog.csdn.net/haijiaoqihao20160106/article/details/50623431 2.客户端的配置 Keep Alive修改.我的xshell的 ...
- PyCharm安装第三方库如Requests
转载: https://blog.csdn.net/fx677588/article/details/56830929 PyCharm安装第三方库是十分方便的,无需pip或其他工具,平台就自带了这个功 ...
- Python编程工具pycharm的使用
简介 俗话说工欲善其事必先利其器,所以对于程序员来说,使用python编程必须有一个强大的Python编程工具,这款工具就是pycharm. PyCharm是一种Python IDE,带有一整套可以帮 ...
- javascript简写精练
一.算术运算符 var n = 5,v; 1.n = n*5; 2.n*=5; 同 n = n*5 二.条件判断 var b = true; 1.if (!false) { alert('true') ...
- 牛客网-《剑指offer》-二进制中1的个数
题目:http://www.nowcoder.com/practice/8ee967e43c2c4ec193b040ea7fbb10b8 C++ 负数需要特殊处理,因为负数右移会补1(符号位) cla ...
- TQ2440与西门子S7-200 PLC自由口通信实现过程中问题总结
1.在win7上安装好PLC编程软件 STEP 7 MicroWIN 之后,无法实现编程软件与PLC的通信连接? 原因:STEP 7 MicroWIN 对win7支持不是很好 解决办法:在win7中安 ...