07-21-06 03:51 PM
Hi,
I am facing a similar problem and i am not able to solve it .
The code is
private final static String DATASOURCE_NAME = "jdbc/MyDataSource";
private DB2DataSource dataSource;
// Create a starting context for naming operations
InitialContext registry = new InitialContext();
//dataSource = (DB2DataSource) registry.lookup(DATASOURCE_NA
ME);
// instead of doing at 1 go , have done it in 2 steps
java.lang.Object obj = registry.lookup(DATASOURCE_NAME);
dataSource = (DB2DataSource) obj;
here when I am casting the object to a DB2DataSource it is giving
"java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource" e
rror
when I change the DB2DataSource to plain DataSource ..it is working fine .
I need the DB2DataSource object explicitly.
Can anybody help me out on this ?
Thanks in advance ,
Dheeraj
quote: Originally posted by
I haven't seen the entire stack trace, so I'm grasping at straws here: Did
you properly reference your DataSource in the ibm-web-bnd.xmi file? In RAD,
you can add resource references by editing your web deployment descriptor a
nd clicking on the "Referen
ces" tab at the bottom of the view. Then just click "Add..." and select "Resource Refer
ence" or "Resource Environment Reference" as appropriate.
[ Post a follow-up to this message ]
|