java – JBOSS:使用Atomikos在Oracle XA Transaction上冻结线程

前端之家收集整理的这篇文章主要介绍了java – JBOSS:使用Atomikos在Oracle XA Transaction上冻结线程前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

当我使用atomikos和hibernate传输一些数据时,我在应用程序上的某个时间后出现错误.

2015-11-06 07:11:56,353 WARN [http-/0.0.0.0:8083-10] datasource.xa.XAResourceTransaction - XA resource 'COTXADBMS': resume for XID '31302E3235332E312E35322E746D30303030313030303939:31302E3235332E312E35322E746D31' raised -7: the XA resource has become unavailable - (Slf4jLogger.java:24) 
oracle.jdbc.xa.OracleXAException
        at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1110)
        at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:240)
        at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:427)
        at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.

然后我们抓住了“冻结”

"http-/0.0.0.0:8083-2" daemon prio=10 tid=0x0000000001914800 nid=0x7640 runnable [0x0000000045ff8000]
   java.lang.Thread.State: RUNNABLE
            at java.net.SocketInputStream.socketRead0(Native Method)
            at java.net.SocketInputStream.read(SocketInputStream.java:152)
            at java.net.SocketInputStream.read(SocketInputStream.java:122)
            at oracle.net.ns.Packet.receive(Packet.java:300)
            at oracle.net.ns.DataPacket.receive(DataPacket.java:106)
            at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:315)
            at oracle.net.ns.NetInputStream.read(NetInputStream.java:260)
            at oracle.net.ns.NetInputStream.read(NetInputStream.java:185)
            at oracle.net.ns.NetInputStream.read(NetInputStream.java:102)
            at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:124)
            at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:80)
            at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1137)
            at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:290)
            at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
            at oracle.jdbc.driver.T4CTTIOtxse.doOTXSE(T4CTTIOtxse.java:163)
            at oracle.jdbc.driver.T4CXAResource.doStart(T4CXAResource.java:186)
            - locked <0x000000078e7f7a40> (a oracle.jdbc.driver.T4CConnection)
            at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:228)
            - locked <0x000000078e7f7a40> (a oracle.jdbc.driver.T4CConnection)
            at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:427)
            - locked <0x00000007ea3500c8> (a com.atomikos.datasource.xa.XAResourceTransaction)
            at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.

它发生在连接处于活动状态的一段时间后,即使不使用这种情况也会发生.

设置 – spring applicationXML

diobjectfactorybean">
    factorybean">
    sql">truefactorybean" class="com.atomikos.jms.AtomikosConnectionfactorybean" init-method="init" destroy-method="close">
    factorybean" />
    diobjectfactorybean">
            factorybean">
    sql">true

anonyone是谁避免这个问题,修复或做一个变通方法

最佳答案
几年前我使用weblogic作为事务管理器而不是atomikos时遇到了类似的问题.在我们的例子中,我们在oracle中有一些例外情况,其中事务已经在oracle中冻结并且忙于连接对象.

我们使用了JTA事务,我在配置文件中看到你正在使用JPA事务,但是我没有看到持久性文件(在其中你将事务类型配置为JTA)

问题与超时事务有关,具体要避免它:

You have to ensure that any transaction timeout (JTA,JPA,etc…)
is lower than the lowest value for XA transactions timeouts (like
oracle XA connections).

要实现此目的,您可以在JDBC连接池配置中分配以下内容

XASetTransactionTimeout -> true 
XATransactionTimeout -> 0

使用XATransactionTimeout – > 0确保XA超时将是事务管理器超时

希望有帮助!

原文链接:https://www.f2er.com/spring/432507.html

猜你在找的Spring相关文章