IBM Support

J2CA0021E error caused by ClassCastException during startup

Troubleshooting


Problem

A J2CA0021E error is thrown during startup caused by a ClassCastException followed by a SCHD0124E: Unable to initialize wps/Scheduler error. This technote provides an explanation of the errors and resolution to the problem.

Symptom

[10/21/09 15:51:44:948 EDT] 00000039 ConnectionMan E J2CA0021E: An exception occurred while trying to get a Connection from the Managed Connection resource jdbc/wpsrelease : javax.resource.ResourceException:
at com.ibm.ejs.j2c.MCWrapper.getConnection(MCWrapper.java:1947)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:639)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:413)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:382)
-
-
Caused by: java.lang.ClassCastException: oracle.jdbc.driver.LogicalConnection
at com.ibm.ws.rsadapter.spi.InternalOracle10gDataStoreHelper.setClientInformation(InternalOracle10gDataStoreHelper.java:302)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.getConnection(WSRdbManagedConnectionImpl.java:2693)
at com.ibm.ejs.j2c.MCWrapper.getConnection(MCWrapper.java:1799)
... 57 more
.
[10/21/09 15:51:44:995 EDT] 00000039 SchedulerImpl E SCHD0124E: Unable to initialize wps/Scheduler due to error: com.ibm.ws.extensionhelper.exception.UnableToInitializeException: java.sql.SQLException:
at com.ibm.ws.extensionhelper.db.impl.DatabaseHelperImpl.connect(DatabaseHelperImpl.java:651)
at com.ibm.ws.extensionhelper.db.impl.DatabaseHelperImpl.initialize(DatabaseHelperImpl.java:463)
at com.ibm.ws.extensionhelper.db.impl.DatabaseHelperImpl.<init>(DatabaseHelperImpl.java:244)
at com.ibm.ws.extensionhelper.impl.ExtensionHelperServiceImpl.getDatabaseHelper(ExtensionHelperServiceImpl.java:142)
-
-
Caused by: java.sql.SQLException:
at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:1160)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:426)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:382)
at com.ibm.ws.extensionhelper.db.impl.DatabaseHelperImpl$DSWrapper.getConnection(DatabaseHelperImpl.java:1442)
at com.ibm.ws.extensionhelper.db.impl.DatabaseHelperImpl.getConnection(DatabaseHelperImpl.java:704)
at com.ibm.ws.extensionhelper.db.impl.DatabaseHelperImpl.getConnection(DatabaseHelperImpl.java:1236)
at com.ibm.ws.extensionhelper.db.impl.DatabaseHelperImpl.connect(DatabaseHelperImpl.java:510)
... 50 more
Caused by: javax.resource.ResourceException:
at com.ibm.ejs.j2c.MCWrapper.getConnection(MCWrapper.java:1947)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:639)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:413)
... 55 more
Caused by: java.lang.ClassCastException: oracle.jdbc.driver.LogicalConnection
at com.ibm.ws.rsadapter.spi.InternalOracle10gDataStoreHelper.setClientInformation(InternalOracle10gDataStoreHelper.java:302)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.getConnection(WSRdbManagedConnectionImpl.java:2693)
at com.ibm.ejs.j2c.MCWrapper.getConnection(MCWrapper.java:1799)
... 57 more

Cause

ClassCastExceptions are generally caused by some type of driver/database mismatch, sometimes even when there are duplicate files in the target directory for the Oracle driver.

In this case there was an older versions of the ojdbc14.jar driver in the \IBM\WebSphere\PortalServer\shared\app directory as well as the version that matched the database.

Resolving The Problem

Remove the duplicate files from the target directory for the Oracle driver.

[{"Product":{"code":"SSHRKX","label":"WebSphere Portal"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"6.1;6.0","Edition":"","Line of Business":{"code":"LOB31","label":"WCE Watson Marketing and Commerce"}}]

Document Information

Modified date:
03 December 2021

UID

swg21408360