java 升级到 Oracle JDBC 瘦驱动程序导致 SQLException: Unexpected exception while enlisting XAConnection

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3604008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 02:37:17  来源:igfitidea点击:

Upgrading to Oracle JDBC thin driver results in SQLException: Unexpected exception while enlisting XAConnection

javajdbcoracle9iweblogic-10.x

提问by mrjohn

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.

在升级到 Oracle JDBC 瘦驱动程序导致SQLException: Unexpected exception while enlisting XAConnection(WebLogic Server 10.0,oracle 版本)中,我们收到下面列出的错误。

We did follow Oracle's advice to

我们确实遵循了 Oracle 的建议

  1. change the global timeout in weblogic, i.e. For the JDBC Connection Pools set the XASetTransactionTimeoutto trueand XATransactionTimeoutto 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
  2. 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

  1. 更改weblogic中的全局超时,即对于JDBC Connection Pools设置XASetTransactionTimeouttrueXATransactionTimeout为零。当这个参数设置为零时,XAResource Session Timeout将设置为全局事务超时。因此需要修改 WLS 上的超时时间
  2. 如果问题仍然存在,可以通过设置来避免KeepXAConnTillTxComplete="true"

    数据库产品版本:Oracle9i 企业版 9.2.0.5.0 版 - 带有分区、OLAP 和 Oracle 数据挖掘选项的生产 JServer 9.2.0.5.0 版 - 生产
    JDBC 驱动程序名称:Oracle JDBC 驱动程序
    JDBC 驱动程序版本:11.1.0.7.0 -生产

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.

我们知道一种选择是不使用 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)

采纳答案by mrjohn

After so consultation from Oracle we decided to upgrade the driver to the latest driver available. This seems to have solved the issue.

在与 Oracle 协商后,我们决定将驱动程序升级到可用的最新驱动程序。这似乎解决了这个问题。