My app is trying to access DataSource through JNDI on Weblogic(12) Server. The following exception is thrown
weblogic.jdbc.common.internal.RmiDataSource_12212_WLStub cannot be cast to javax.sql.DataSource
Where is this class weblogic.jdbc.common.internal.RmiDataSource_12212_WLStub coming into picture.
From My Oracle Support (Doc ID 2005891.1) Version 12.1.1.0 and later
The remote datasource lookup over RMI is not supported with any thin client jar file.
The Wlthint3client.jar library does not support remote datasource lookup over RMI as the required stub classes are not bundled with this jar file, and hence the error.
JDBC over RMI is also deprecated in general and it can easily be a significant security vulnerability.
It normally works with the full WLS client jar library. But it is also not recommended - as this feature is currently deprecated and it might be completely removed in the future release.
Alternatives are to use the JDBC driver if you want to create connections to the database from a remote client, or deploy a local EJB which acquires the connection by doing a local lookup of the datasource.