升级到 Oracle JDBC 瘦驱动程序会导致 SQLException:征用 XAConnection 时出现意外异常
在升级到 Oracle JDBC 瘦驱动程序导致SQLException:征用 XAConnection 时发生意外异常
(WebLogic Server 10.0,oracle 版本)中,我们收到下面列出的错误。
我们确实按照 Oracle 的建议
- 更改了 weblogic 中的全局超时,即对于 JDBC 连接池,将
XASetTransactionTimeout
设置为true
并将XATransactionTimeout
设置为零 当此参数设置为零时,XAResource 会话超时将设置为全局事务超时。 因此,需要修改 WLS 的超时 如果问题仍然存在,可以通过设置
KeepXAConnTillTxComplete="true"
来避免。数据库产品版本:Oracle9i 企业版版本 9.2.0.5.0 - 生产版,具有分区、OLAP 和 Oracle Data Mining 选项 JServer 版本 9.2.0.5.0 - 生产版
JDBC 驱动程序名称:Oracle JDBC 驱动程序
JDBC 驱动程序版本:11.1.0.7.0-Production
我们知道一种选择是不使用 XA 连接,但在我们的例子中这是不可能的。我们确实需要使用 XA 连接。
java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_PROTO start() failed on resource 'serviceDataSource': XAER_PROTO : Routine was invoked in an inproper context
oracle.jdbc.xa.OracleXAException
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1101)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:237)
at weblogic.jdbc.wrapper.VendorXAResource.start(VendorXAResource.java:50)
at weblogic.jdbc.jta.DataSource.start(DataSource.java:696)
at weblogic.transaction.internal.XAServerResourceInfo.start(XAServerResourceInfo.java:1183)
at weblogic.transaction.internal.XAServerResourceInfo.xaStart(XAServerResourceInfo.java:1116)
at weblogic.transaction.internal.XAServerResourceInfo.enlist(XAServerResourceInfo.java:275)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:508)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:435)
at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1407)
at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1331)
at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:426)
at weblogic.jdbc.jta.DataSource.connect(DataSource.java:383)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:339)
In Upgrading to Oracle JDBC thin driver results in SQLException: Unexpected exception while enlisting XAConnection
(WebLogic Server 10.0, oracle version ) we are getting the error listed below.
We did follow Oracle's advice to
- change the global timeout in weblogic, i.e. For the JDBC Connection Pools set the
XASetTransactionTimeout
totrue
andXATransactionTimeout
to zero
When this parameter is set to zero, the XAResource Session Timeout will be set to the global transaction timeout.
Hence the time out on the WLS needs to be modified If the issue still remains it can be avoided by setting
KeepXAConnTillTxComplete="true"
.Database Product Version : Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.5.0 - Production
JDBC Driver Name : Oracle JDBC driver
JDBC Driver Version : 11.1.0.7.0-Production
We know one option is not to use an XA connection, but in our case that is not a possibility. We defenitly need to use XA connections.
java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_PROTO start() failed on resource 'serviceDataSource': XAER_PROTO : Routine was invoked in an inproper context
oracle.jdbc.xa.OracleXAException
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1101)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:237)
at weblogic.jdbc.wrapper.VendorXAResource.start(VendorXAResource.java:50)
at weblogic.jdbc.jta.DataSource.start(DataSource.java:696)
at weblogic.transaction.internal.XAServerResourceInfo.start(XAServerResourceInfo.java:1183)
at weblogic.transaction.internal.XAServerResourceInfo.xaStart(XAServerResourceInfo.java:1116)
at weblogic.transaction.internal.XAServerResourceInfo.enlist(XAServerResourceInfo.java:275)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:508)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:435)
at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1407)
at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1331)
at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:426)
at weblogic.jdbc.jta.DataSource.connect(DataSource.java:383)
at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:339)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在与 Oracle 协商后,我们决定将驱动程序升级到可用的最新驱动程序。这似乎已经解决了问题。
After so consultation from Oracle we decided to upgrade the driver to the latest driver available. This seems to have solved the issue.