利用Jotm 2使Tomcat 6具有分布式事务管理功能
来源:互联网 发布:php存储json 编辑:程序博客网 时间:2024/06/06 14:17
使用Spring 2.5 Hibernate 3.5 Tomcat 6 Jotm 2配置分布式事务管理,多数据源事务管理。
因为Spring自己带了org.springframework.transaction.jta.JotmFactoryBean所以决定用Jotm2.1.9来做分布式事务管理。
运行环境为:
JDK 1_5_0_22
apache-tomcat-6.0.20
ow2-jotm-dist-2.1.9-bin/ow2-jotm-dist-2.1.9/lib/*.jar
ojdbc14.jar
jtds-1.2.5-dist/jtds-1.2.5.jar
hibernate-distribution-3.5.5-Final/hibernate3.jar
hibernate-distribution-3.5.5-Final/lib/required/*.jar
spring-framework-2.5.6.SEC02-with-docs/spring-framework-2.5.6.SEC02/dist/spring.jar
MS SQL Server 2000 + SP4数据库
Oracle 10g数据库
下面是Application-jta.xml配置文件的全部内容
<?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:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-2.5.xsd
">
<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="userTransaction" ref="jotm"/>
</bean>
<bean id="oracleDataSource" class="org.enhydra.jdbc.standard.StandardXADataSource"destroy-method="shutdown">
<property name="transactionManager" ref="jotm"/>
<property name="driverName" value="oracle.jdbc.driver.OracleDriver"/>
<property name="url" value="jdbc:oracle:thin:@192.168.1.3:1521:orcl"/>
<property name="user" value="system"/>
<property name="password" value="123456789"/>
</bean>
<bean id="firstdataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"destroy-method="shutdown">
<property name="dataSource" ref="oracleDataSource"/>
<property name="user" value="system"/>
<property name="password" value="123456789"/>
<property name="maxSize" value="5"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="firstdataSource"/>
<property name="mappingDirectoryLocations">
<list>
<value>classpath:/com/huangcheng/pojo</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.format_sql=true
hibernate.show_sql=true
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
hibernate.query.substitutions=true1, false 0
hibernate.jdbc.batch_size=20
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
hibernate.cache.provider_configuration_file_resource_path=/ehcache-hibernate.xml
</value>
</property>
</bean>
<bean id="mssqlDataSource" class="org.enhydra.jdbc.standard.StandardXADataSource"destroy-method="shutdown">
<property name="transactionManager" ref="jotm"/>
<property name="driverName" value="net.sourceforge.jtds.jdbc.Driver"/>
<property name="url" value="jdbc:jtds:sqlserver://127.0.0.1:1433/master"/>
<property name="user" value="sa"/>
<property name="password" value="sa"/>
</bean>
<bean id="secondDataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"destroy-method="shutdown">
<property name="dataSource" ref="mssqlDataSource"/>
<property name="user" value="sa"/>
<property name="password" value="sa"/>
<property name="maxSize" value="5"/>
</bean>
<bean id="sessionFactoryMSSQL2000" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="secondDataSource"/>
<property name="mappingDirectoryLocations">
<list>
<value>classpath:/com/huangcheng/mssql/entity</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.format_sql=true
hibernate.show_sql=true
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.query.substitutions=true1, false 0
hibernate.jdbc.batch_size=20
hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
hibernate.cache.provider_configuration_file_resource_path=/ehcache-hibernate.xml
</value>
</property>
</bean>
<aop:config>
<aop:pointcut id="commonPointcut" expression="execution(* *..manager.*Manager.*(..))"/>
<aop:advisor id="managerTx" advice-ref="txAdvice"pointcut-ref="commonPointcut" order="0"/>
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*"rollback-for="Exception"/>
</tx:attributes>
</tx:advice>
</beans>
- 利用Jotm 2使Tomcat 6具有分布式事务管理功能
- JOTM分布式事务管理(多数据源)配置
- spring集成jotm实现JTA分布式事务管理
- JOTM分布式事务管理(多数据源)配置
- 使用JOTM实现分布式事务管理(多数据源)
- (ZT)使用JOTM实现分布式事务管理(多数据源)
- 使用JOTM实现分布式事务管理(多数据源)
- 使用JOTM实现分布式事务管理(多数据源)
- 使用JOTM实现分布式事务管理(多数据源)
- 使用JOTM实现分布式事务管理(多数据源)
- 使用JOTM实现分布式事务管理(多数据源)
- spring+jotm 多数据源事务管理(三)JNDI+Tomcat
- JTA集成JOTM或Atomikos配置分布式事务(Tomcat应用服务器)
- JTA集成JOTM或Atomikos配置分布式事务(Tomcat应用服务器)
- JTA集成JOTM或Atomikos配置分布式事务(Tomcat应用服务器)
- JTA集成JOTM或Atomikos配置分布式事务(Tomcat应用服务器)
- JTA集成JOTM或Atomikos配置分布式事务(Tomcat应用服务器)
- spring4+hibernate4+jotm 分布式事务
- 位软件工程师的7年总结:借此导航自己人生
- MYSQL和ORACLE中使用LIKE的小区别
- 在VC6.0中如何让new操作失败后抛出异常?
- 解决:Qt中启动错误,msg如下:The process could not be started!
- 不用加法运算而用实现 变量加 1 功能 C 代码
- 利用Jotm 2使Tomcat 6具有分布式事务管理功能
- Silverlight与WPF开发人员入门应该知道的十件事
- Vim自动高亮代码块脚本
- 程序设计语言正交特性的一点思考
- Android 体系结构介绍
- 在右键菜单中添加应用程序
- GIS地图缩放级别和各级别分辨率的计算
- HTMl 工具类
- 单链表的两种逆序算法