ArrayOutOfBoundException和OracleXAException(XAException.XAER_RMFAIL)异常

时间:2016-01-05 09:55:24

标签: oracle wildfly-8 sqlexception oracleexception

我使用的是Oracle Database 11g 11.2.0.4.0版 - 64位数据库和WildFly 8.2.0 Application Server。我在我们的应用程序和XA事务中使用托管连接。

当我尝试执行非常复杂的查询(select> 1400的参数数量 - 使用的别名数> 1400 - 连接数> 1400)时,会返回以下异常:

2016-01-05 10:20:48,108 WARN  [org.jboss.jca.core.connectionmanager.listener.TxConnectionListener] (default task-1) IJ000305: Connection error occured: org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@f1bbadb[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@6e35335 connection handles=1 lastUse=1451985632822 trackByTx=true pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@3f76ea19 mcp=SemaphoreArrayListManagedConnectionPool@529c5c92[pool=datamodel-oracleDS] xaResource=XAResourceWrapperImpl@18032fdc[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@6e35335 pad=false overrideRmValue=false productName=Oracle productVersion=Oracle Database 11g Release 11.2.0.4.0 - 64bit Production jndiName=java:/datamodel-oracleDS] txSync=null]: java.lang.ArrayIndexOutOfBoundsException: 128
...
2016-01-05 10:20:48,217 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-1) SQL Error: 0, SQLState: null
2016-01-05 10:20:48,219 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-1) Error
2016-01-05 10:20:48,260 ERROR [org.jboss.as.ejb3] (default task-1) javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: could not execute query
...
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query
...
Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.loader.Loader.doList(Loader.java:2557) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.loader.Loader.doList(Loader.java:2540) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2370) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.loader.Loader.list(Loader.java:2365) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:497) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:236) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1264) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:495) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    ... 389 more
Caused by: java.sql.SQLException: Error
    at org.jboss.jca.adapters.jdbc.WrappedConnection.checkException(WrappedConnection.java:1648)
    at org.jboss.jca.adapters.jdbc.WrappedStatement.checkException(WrappedStatement.java:1267)
    at org.jboss.jca.adapters.jdbc.WrappedResultSet.checkException(WrappedResultSet.java:4063)
    at org.jboss.jca.adapters.jdbc.WrappedResultSet.next(WrappedResultSet.java:1866)
    at org.hibernate.loader.Loader.processResultSet(Loader.java:950) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.loader.Loader.doQuery(Loader.java:921) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:355) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.loader.Loader.doList(Loader.java:2554) [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
    ... 399 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 128
2016-01-05 10:20:48,529 WARN  [com.arjuna.ats.jta] (default task-1) ARJUNA016045: attempted rollback of < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff7f000001:1d0483f3:568b8971:1c, node_name=1, branch_uid=0:ffff7f000001:1d0483f3:568b8971:2c, subordinatenodename=null, eis_name=java:/datamodel-oracleDS > (XAResourceWrapperImpl@18032fdc[xaResource=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@6e35335 pad=false overrideRmValue=false productName=Oracle productVersion=Oracle Database 11g Release 11.2.0.4.0 - 64bit Production jndiName=java:/datamodel-oracleDS]) failed with exception code XAException.XAER_RMFAIL: oracle.jdbc.xa.OracleXAException
...

我正在尝试修复它,我搜索了许多链接,网站,博客但没有结果。我已经尝试了一切,但我无法解决问题。

这是导致XA交易出现问题的原因,但我无法确定具体原因。 我只是注意到减少了查询的参数和连接数,问题不再发生,所以我认为它与数据库中这些数字的固定限制有关。

请帮助我找出此异常的确切原因和解决方案。提前谢谢。

1 个答案:

答案 0 :(得分:0)

如果你减少了绑定数量,问题就不会重现,这可能与你使用XA的事实无关。我建议升级驱动程序。对于11.2.0.4数据库,您可以使用12.1.0.2中的驱动程序。在Google&#34; Oracle JDBC 12.1.0.2&#34;中搜索从下载页面中,您可以找到ojdbc6.jar(与JDK6一起使用)或ojdbc7.jar(与JDK7或更高版本一起使用)。此类异常通常在最新版本的驱动程序中解决。