"java.lang.ClassCastException: java.lang.Boolean cannot be cast to oracle.ucp.jdbc.oracle.OracleConnectionAffinityContext" Error When Calling Getconnectionaffinitycontext() Method in Class SessionAffinityCallback or XAAffinityCallback in a Grid Link DS

(Doc ID 2284500.1)

Last updated on JULY 10, 2017

Applies to:

Oracle WebLogic Server - Version and later
Information in this document applies to any platform.


When calling getConnectionAffinityContext in class weblogic/jdbc/common/internal/SessionAffinityCallback or weblogic/jdbc/common/internal/XAAffinityCallback, the returning type for the method is not consistent.

- if there is an exception thrown in the method, it returns a Boolean object instead of the expected null object

- otherwise, it returns oracle.ucp.jdbc.oracle.OracleConnectionAffinityContext which is the expected value


Eventually, when an exception is thrown, it causes the additional exception below as that is not expected by the application. The excepted return type is either a null object or oracle.ucp.jdbc.oracle.OracleConnectionAffinityContext object.

java.sql.SQLException: Pool connect failed : java.lang.ClassCastException:
java.lang.Boolean cannot be cast to oracle.ucp.jdbc.oracle.OracleConnectionAffinityContext
at weblogic.jdbc.common.internal.JDBCUtil.wrapAndThrowResourceException(JDBCUtil.java:277)
at weblogic.jdbc.pool.Driver.connect(Driver.java:153)
at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:662)
at weblogic.jdbc.jts.Driver.connect(Driver.java:128)


Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms