My Oracle Support Banner

ValidateConnectionOnBorrow Fails With java.lang.ClassCastException For UCP XA Datasource (Doc ID 2699331.1)

Last updated on AUGUST 11, 2020

Applies to:

Universal Connection Pool - Version 12.1.0.2.0 and later
Information in this document applies to any platform.

Symptoms

XA connection with the parameter “validateConnectionOnBorrow” set to true on a sharding database fails with:

Exception in thread "main" java.lang.ClassCastException: oracle.jdbc.driver.T4CXAConnection cannot be cast to java.sql.Connection
  at oracle.ucp.jdbc.oracle.OracleUniversalPooledConnection.setShardingKeyIfValid(OracleUniversalPooledConnection.java:288)
  at oracle.ucp.jdbc.oracle.OracleUniversalPooledConnection.isValid(OracleUniversalPooledConnection.java:244)
  at oracle.ucp.common.UniversalConnectionPoolImpl.borrowConnectionAndValidate(UniversalConnectionPoolImpl.java:164)
  at oracle.ucp.common.UniversalConnectionPoolImpl.borrowConnection(UniversalConnectionPoolImpl.java:122)
  at oracle.ucp.jdbc.JDBCConnectionPool.borrowConnection(JDBCConnectionPool.java:174)
  at oracle.ucp.jdbc.oracle.OracleJDBCConnectionPool.borrowConnection(OracleJDBCConnectionPool.java:613)
  at oracle.ucp.jdbc.PoolXADataSourceImpl.getXAConnection(PoolXADataSourceImpl.java:268)
  at oracle.ucp.jdbc.PoolXADataSourceImpl$1.build(PoolXADataSourceImpl.java:297)

UCP versions used is:
ucp.jar version 19.3 with patch 30157368


Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.