问题描述:

Error occured processing XML 'org/aopalliance/intercept/MethodInterceptor'. See Error Log for more details

全部配置如下:

 <?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:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd"> <!-- 配置自动扫描的包 -->
<context:component-scan base-package="com.mcs.hibernate"></context:component-scan> <!-- 配置数据源 -->
<!-- 导入资源文件 -->
<context:property-placeholder location="classpath:db.properties"/>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="user" value="${jdbc.user}"></property>
<property name="password" value="${jdbc.password}"></property>
<property name="driverClass" value="${jdbc.driverClass}"></property>
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property> <property name="initialPoolSize" value="${c3p0.initialPoolSize}"></property>
<property name="maxPoolSize" value="${c3p0.maxPoolSize}"></property>
</bean> <!-- 配置Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property> <!-- 加载Hibernate的配置文件 -->
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
<!-- 加载Hibernate 映射文件的位置及名称, 可以使用通配符 -->
<property name="mappingLocations" value="classpath:com/mcs/hibernate/entities/*.hbm.xml"></property>
</bean> <!-- 配置 Spring 的声明式事务 -->
<!-- . 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean> <!-- . 配置事务属性, 需要事务管理器 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="*"/>
</tx:attributes>
</tx:advice> <!-- . 配置事务切点, 并把切点和事务属性关联起来 -->
<aop:config>
<aop:pointcut expression="execution(* com.mcs.hibernate.service.*.*(..))"
id="txPointcut"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
</aop:config> </beans>

解决方法:加入以下两个Jar包即可

解决在Spring整合Hibernate配置tx事务管理器出现错误的问题的更多相关文章

  1. Hibernate配置与事务管理

    数据库中 @num:代表一个变量 Set @num = 10; Select @num+@num from dual;  dual:临时表 得到结果 20 Hibernate:运用数据持久化,使用OR ...

  2. 【Spring实战-3】Spring整合Hibernate、Struts

    作者:ssslinppp      1. 摘要 版本: Spring4.0.4:Hibernate4.3.5:struts2.3.16: 主要介绍了如下内容: 项目结构的规划: Spring下整合Hi ...

  3. spring的annotation-driven配置事务管理器详解

    http://blog.sina.com.cn/s/blog_8f61307b0100ynfb.html ——————————————————————————————————————————————— ...

  4. spring 配置事务管理器

    在Spring中数据库事务是通过PlatformTransactionManager进行管理的,jdbcTemplate是不能支持事务的,而能够支持事务的是org.springframework.tr ...

  5. 事务隔离级别与传播机制,spring+mybatis+atomikos实现分布式事务管理

    1.事务的定义:事务是指多个操作单元组成的合集,多个单元操作是整体不可分割的,要么都操作不成功,要么都成功.其必须遵循四个原则(ACID). 原子性(Atomicity):即事务是不可分割的最小工作单 ...

  6. Spring事务隔离级别与传播机制详解,spring+mybatis+atomikos实现分布式事务管理

    原创说明:本文为本人原创作品,绝非他处转载,转账请注明出处 1.事务的定义:事务是指多个操作单元组成的合集,多个单元操作是整体不可分割的,要么都操作不成功,要么都成功.其必须遵循四个原则(ACID). ...

  7. 深入学习Spring框架(四)- 事务管理

    1.什么是事务? 事务(Transaction)是一个操作序列.这些操作要么都做,要么都不做,是一个不可分割的工作单位,是数据库环境中的逻辑工作单位.事务是为了保证数据库的完整性.例如:A给B转账,需 ...

  8. Spring 简单而强大的事务管理功能

    开始之前 关于本教程 本教程将深入讲解 Spring 简单而强大的事务管理功能,包括编程式事务和声明式事务.通过对本教程的学习,您将能够理解 Spring 事务管理的本质,并灵活运用之. 先决条件 本 ...

  9. Spring事务管理器分类

    Spring并不直接管理事务,事实上,它是提供事务的多方选择.你能委托事务的职责给一个特定的平台实现,比如用JTA或者是别的持久机制.Spring的事务管理器可以用下表表示: 事务管理器的实例 目标 ...

随机推荐

  1. 用jQuery,ajax,实现三级联动封装JS的文件

    // JavaScript Document $(document).ready(function(e) { //找到ID=SANJI的DIV,造三个下拉扔进去 var str = "< ...

  2. Java-Class-C:org.springframework.http.HttpHeaders

    ylbtech-Java-Class-C:org.springframework.http.HttpHeaders 1.返回顶部 1.1. import org.springframework.htt ...

  3. nginx分布式实例入门操作

    本文目的 前段时间学习WCF已经渐入佳境,完成了既定学习目标,转入分布式系统学习.本文技术路线是: 采用wcf实现分布式服务端和客户端,客户端部署于本地主机,nginx和WCF部署于虚拟机端(分别是三 ...

  4. CodeForces-1244C-The Football Season-思维

    The football season has just ended in Berland. According to the rules of Berland football, each matc ...

  5. Soci介绍

    soci是一个用C++封装的数据库访问库,目前通过 “前端(应用程序)/核心/后端(数据库适配)”模式支持firebird,mysql,sqlite3,oracle,postgresql,odbc多种 ...

  6. Response案例1_重定向

    import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.serv ...

  7. django静态文件的配置

    Django static静态配置文件   对于Django来说静态文件一般交由Web服务器处理,Django本身不处理静态文件.为了使Django开发环境能够处理静态文件,Django有和生产环境不 ...

  8. 分布式唯一ID实现

    ID生成的核心需求 全局唯一 趋势有序 为什么要全局唯一 避免ID冲突 著名的例子就是身份证号码,身份证号码确实是对人唯一的,然而一个人是可以办理多个身份证的,例如你身份证丢了,又重新补办了一张,号码 ...

  9. 一个切图仔的 CSS 笔记

    1,flexbox~注意,设为 Flex 布局以后,子元素的float.clear和vertical-align属性将失效. 在ios8上要加上前缀 display: -webkit-box; dis ...

  10. 微信公众号开发API接口大全

    在本文中,我们列出微信公众平台上可以使用的API接口以及举例如何在微信公众平台调用这些接口实现相应的功能. 接口调用说明: ① Appkey请使用的微信公众号,不要使用默认的trailuser ② 接 ...