|
Problem(Abstract) |
In WebSphere® Application Server V5, the following
exception might be issued during the JNDI™ lookup of a data source:
"java.lang.ClassCastException:
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource"
This might occur only when using an XA-enabled data source. |
|
|
|
Cause |
The application code that performs the JNDI lookup is
causing the problem. The following application code is casting the object
returned by the JNDI lookup to javax.sql.XADataSource, instead of
javax.sql.DataSource:
XADataSource ds = (XADataSource)
ctx.lookup(jndiDataSource); |
|
|
|
Resolving the
problem |
Change the application to the following to cast the object
returned by the JNDI lookup to javax.sql.DataSource:
DataSource ds = (DataSource)
ctx.lookup(jndiDataSource); |
|
The WebSphere Application Server Relational Resource Adapter wrappers the
XADataSource; therefore, there is no need for the application to use the
javax.sql.XADataSource class. Applications should use only the
javax.sql.DataSource. All that is needed to use an XA data source
is to configure the data source under an XA-enabled JDBC Provider in the
Admin Console. |
|
|