1.登陆Was控制台,配置XA数据源,这有XA的数据源才可以支持分布式事务。
2.在xml里面配置dataSource和transactionManager,applicationContext-was.xml
<!-- JNDI DataSource -->
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/db" />
<!-- Transaction manager for XA DataSource -->
<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>
3.通过AOP实现将事务代理到指定的方法上,applicationContext-base.xml
<!-- Annotation Initilization -->
<context:annotation-config />
<!-- 扫描com.lq包里的接口 -->
<context:component-scan base-package="com.lq" scoped-proxy="interfaces" />
<aop:config>
<!-- 代理com.lq.*.service.*Service命名的接口里的所有的方法 -->
<aop:advisor id="managerTx" advice-ref="txAdvice"
pointcut="execution(* *..service.*Service.*(..))" order="1" />
</aop:config>
<!-- enable the configuration of transactional behavior based on annotations -->
<tx:annotation-driven transactionmanager="transactionManager" />
<!-- Transaction -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" />
<tx:method name="find*" read-only="true" />
<tx:method name="query*" read-only="true" />
</tx:attributes>
</tx:advice>
4.把这些xml文件放到web.xml中
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:conf/spring/applicationContext-base.xml
classpath*:conf/spring/applicationContext-was.xml
</param-value>
</context-param>
要实现分布式事务的两台机器都要配置名称相同的XA数据源。
分享到:
相关推荐
WAS_7.0之分布式平台安装配置与应用部署
WAS集群配置文档WAS集群配置文档WAS集群配置文档WAS集群配置文档WAS集群配置文档WAS集群配置文档WAS集群配置文档WAS集群配置文档
was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置was jms配置...
网上找这个WebSphere(was)中间件或者应用服务器的相关资料还是挺少的。这里是一份关于was如何配置https证书,实现https访问的教程。
WAS 安全性配置 WAS 安全性配置 WAS 安全性配置 WAS 安全性配置 WAS 安全性配置
WAS常用配置WAS常用配置WAS常用配置WAS常用配置WAS常用配置WAS常用配置WAS常用配置WAS常用配置WAS常用配置WAS常用配置
Prior to joining Zillabyte, he was a machine learning software consultant for two years. Peter spends his free time competing in programming competitions and building 3D printers.
WAS8.5.5.0图形化界面升级至8.5.5.13及配置JDK1.8手册
WAS补丁说明,描述了was打补丁的配置过程
IHS与WAS关联的配置 IHS与WAS关联 IHS与WAS关联
was数据源配置教程
利用IBM WAS中间件特性,实现分布式缓存和服务器间的数据共享。 利用IBM WAS的 DistributedMap 数据对象。 虽然“中间件依赖”是不被提倡的,但是它简单高效啊。 简单的操作就能带给我们飞一般的性能体验,不需要...
IBM WAS ND 分布式网络环境的理解与集群的实现
实验目的:本实验描述了在WAS的管理控制台中配置一些WAS的基本参数,如配置Web容器参数、配置JVM参数,配置线性池参数,查询服务器端口信息等
WAS6配置说明.
在WAS环境下如何配置WebService资源。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
No key was installed for encryption service
wasND安装配置wasND安装配置wasND安装配置wasND安装配置wasND安装配置
word文档类--WAS数据库连接配置文档
本文档图文并茂,生动详细地介绍了was8.5.5配置https协议的步骤,并经多人测试和检验。