XAException:由于XA异常导致的两阶段提交回滚失败

时间:2012-03-22 16:21:34

标签: java-ee transactions db2 websphere 2phase-commit

好的,看似简单的两阶段提交实现正在遇到问题。 我的设置是DB2服务器上的2个数据库,一个托管在Websphere 6.1上的应用程序。交易管理由Atomikos处理。通过jndi连接数据库。我开始UserTransaction,在DB1上执行更新,在更新到DB2时失去与DB的连接以获取调用回滚的 StaleConnectionException 。理想情况下,TM应该为事务执行回滚。但是,我收到如下XAException:

[3/22/12 11:52:21:022 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_0.txt

[3/22/12 11:52:21:053 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_0.txt
[3/22/12 11:52:21:053 EDT] 00000023 WSRdbXaResour E   DSRA0304E:  XAException occurred. XAException contents and details are: 
The DB2 Error message is : [jcc][t4][10335][11391][3.53.70] Invalid operation: Connection is closed. ERRORCODE=-4470, SQLSTATE=08003
The DB2 Error code is    : -4470
The DB2 SQLState is      : 08003
.
[3/22/12 11:52:21:053 EDT] 00000023 WSRdbXaResour E   DSRA0302E:  XAException occurred.  Error code is: XAER_RMFAIL (-7).  Exception is: [jcc][t4][10401][12066][3.53.70] XA exception: XAER_RMFAIL : [jcc][t4][10335][11391][3.53.70] Invalid operation: Connection is closed. ERRORCODE=-4470, SQLSTATE=08003 ERRORCODE=-4228, SQLSTATE=null
[3/22/12 11:52:21:085 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_1.txt
[3/22/12 11:52:21:100 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_1.txt
[3/22/12 11:52:21:116 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_2.txt
[3/22/12 11:52:21:163 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_2.txt
[3/22/12 11:52:21:194 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_3.txt
[3/22/12 11:52:21:225 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_3.txt
[3/22/12 11:52:21:256 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_4.txt
[3/22/12 11:52:21:288 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_4.txt
[3/22/12 11:52:21:288 EDT] 00000023 WSRdbXaResour E   DSRA0304E:  XAException occurred. XAException contents and details are: 
The DB2 Error message is : [jcc][t4][2030][11211][3.53.70] A communication error occurred during operations on the connection's underlying socket, socket input stream, 
or socket output stream.  Error location: T4Agent.sendRequest().  Message: Connection reset by peer: socket write error. ERRORCODE=-4499, SQLSTATE=08001
The DB2 Error code is    : -4499
The DB2 SQLState is      : 08001
.
[3/22/12 11:52:21:288 EDT] 00000023 WSRdbXaResour E   DSRA0302E:  XAException occurred.  Error code is: XA_RETRY (4).  Exception is: [jcc][t4][10401][12066][3.53.70] XA exception: XA_RETRY : [jcc][t4][2030][11211][3.53.70] A communication error occurred during operations on the connection's underlying socket, socket input stream, 
or socket output stream.  Error location: T4Agent.sendRequest().  Message: Connection reset by peer: socket write error. ERRORCODE=-4499, SQLSTATE=08001 ERRORCODE=-4228, SQLSTATE=null
[3/22/12 11:52:21:288 EDT] 00000023 ConnectionEve A   J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource jdbc/myDatasource1.  The exception which was received is com.ibm.db2.jcc.b.po: [jcc][t4][10401][12066][3.53.70] XA exception: XA_RETRY : [jcc][t4][2030][11211][3.53.70] A communication error occurred during operations on the connection's underlying socket, socket input stream, 
or socket output stream.  Error location: T4Agent.sendRequest().  Message: Connection reset by peer: socket write error. ERRORCODE=-4499, SQLSTATE=08001 ERRORCODE=-4228, SQLSTATE=null:com.ibm.db2.jcc.b.tn: [jcc][t4][2030][11211][3.53.70] A communication error occurred during operations on the connection's underlying socket, socket input stream, 
or socket output stream.  Error location: T4Agent.sendRequest().  Message: Connection reset by peer: socket write error. ERRORCODE=-4499, SQLSTATE=08001:java.net.SocketException: Connection reset by peer: socket write error
[3/22/12 11:52:21:319 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_5.txt
[3/22/12 11:52:21:335 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_5.txt
[3/22/12 11:52:21:350 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_6.txt
[3/22/12 11:52:21:397 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_6.txt
[3/22/12 11:52:21:413 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_7.txt
[3/22/12 11:52:21:444 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_7.txt
[3/22/12 11:52:21:522 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl open FFDC0009I: FFDC opened incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_8.txt
[3/22/12 11:52:21:553 EDT] 00000023 ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\was61profile1\logs\ffdc\server1_00000023_12.03.22_11.52.21_8.txt
[3/22/12 11:53:16:804 EDT] 00000023 SystemOut     O Transaction Failed
[3/22/12 11:53:21:522 EDT] 0000000f InternalDB2Un I   DSRA8203I: Database product name : DB2/NT
[3/22/12 11:53:21:522 EDT] 0000000f InternalDB2Un I   DSRA8204I: Database product version : SQL09056
[3/22/12 11:53:21:522 EDT] 0000000f InternalDB2Un I   DSRA8205I: JDBC driver name  : IBM DB2 JDBC Universal Driver Architecture
[3/22/12 11:53:21:522 EDT] 0000000f InternalDB2Un I   DSRA8206I: JDBC driver version  : 3.53.70
[3/22/12 11:53:21:522 EDT] 0000000f InternalDB2Un I   DSRA8212I: DataStoreHelper name is: com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper@150a150a.
[3/22/12 11:53:21:522 EDT] 0000000f WSRdbDataSour I   DSRA8208I: JDBC driver type  : 4
[3/22/12 11:53:21:585 EDT] 0000000f WSRdbXaResour E   DSRA0304E:  XAException occurred. XAException contents and details are: "".
[3/22/12 11:53:21:585 EDT] 0000000f WSRdbXaResour E   DSRA0302E:  XAException occurred.  Error code is: XAER_NOTA (-4).  Exception is: [jcc][t4][10401][12066][3.53.70] XA exception: XAER_NOTA ERRORCODE=-4228, SQLSTATE=null

执行更新的DB1表在此之后获得LOCKED。我到目前为止尝试过以下但仍然无法执行回滚:

  1. 查询使用uncommited reads('ur')
  2. 连接自动提交设置为false,IsolationLevel设置为* TRANSACTION_READ_UNCOMMITTED *
  3. 增加了数据源和事务服务的各种超时值。
  4. 连接池最小连接数设置为0,清除策略:EntirePool
  5. 正在捕获
  6. StaleConnectionException ,并从catch块调用UserTransaction.rollback()。
  7. 如何使用两阶段提交和XAtransactions从数据库崩溃中恢复? 有什么指针应该为此做什么?

0 个答案:

没有答案