Distributed Transactions and Timeouts

We're using JTA distributed transactions (across WebLogic 8.1 and Oracle), and we noticed that the following exception occasionally was causing us errors:
java.sql.SQLException: 
Unexpected exception while enlisting XAConnection java.sql.SQLException: 
XA error: XAER_NOTA : The XID is not valid start() failed on resource '[connection pool]': 
XAER_NOTA : 
The XID is not valid oracle.jdbc.xa.OracleXAException
 at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1017)
 at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:227)
 at weblogic.jdbc.wrapper.VendorXAResource.start(VendorXAResource.java:50)

Turns out that Oracle was timing out the transaction on its side of things.  Here's a general description of the problem:
A general rule to follow is to make sure that WebLogic Server JTA timeout (either global, specific to an EJB or for individual transactions) is set to a lower value than the shortest timeout value configured/set for a participating XA resource (e.g., XA Transaction Timeout for Oracle XA JDBC connections). Not doing so can lead to an unexpected and inconsistent distributed transaction outcome, i.e., a participating XA Resource timing out before WebLogic Server JTA as the distributed transaction coordinator. The timed out XA Resource may take action to resolve its own part of the distributed transaction before WebLogic Server can take action. This will lead to heuristic error messages at the time when the WebLogic transaction manager tries to prepare/commit the distributed transaction.

The solution was that for the JDBC Connection Pools to set the XASetTransactionTimeout to true and XATransactionTimeout to zero ("When this parameter is set to zero, the XAResource Session Timeout will be set to the global transaction timeout.")

Hope this post helps save some people the hassle we went through to figure this out...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
分布式系统是一种由多个独立的计算机节点组成的系统,这些节点通过网络互相通信和协调,共同完成任务。分布式系统的原则和范例可以总结如下。 首先,容错性是分布式系统的重要原则之一。由于分布式系统由多个节点组成,节点之间的通信可能会遇到错误、故障或延迟。为了提高系统的可靠性,分布式系统需要具备容错机制,能够自动检测和纠正错误,保证系统的正常运行。 其次,一致性是分布式系统的核心原则之一。分布式系统中的数据通常被存储在不同的节点上,这就带来了数据一致性的挑战。为了保证数据的一致性,分布式系统需要使用合适的一致性协议和算法,确保各个节点之间的数据一致性和同步。 同时,可扩展性也是分布式系统的重要原则之一。分布式系统需要具备良好的可扩展性,能够根据用户需求动态地扩展节点数量和处理能力。通过水平扩展和垂直扩展等手段,分布式系统可以实现高性能和高可用性。 此外,安全性也是分布式系统的原则之一。由于分布式系统中的节点和网络是开放的,容易受到安全攻击和数据泄露的威胁。为了保障系统的安全,分布式系统需要实现合适的安全机制,包括身份认证、数据加密和访问控制等。 最后,弹性性是分布式系统的原则之一。分布式系统需要具备弹性,能够在节点故障、网络拥塞或大量请求压力下保持正常运行。通过引入负载均衡、流量控制和自动伸缩等机制,分布式系统可以提高其弹性,并能够快速恢复正常运行。 总之,分布式系统的原则和范例包括容错性、一致性、可扩展性、安全性和弹性性。这些原则和范例的应用可以提高分布式系统的可靠性、性能和安全性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值