Reputation: 157
I am facing a class cast exception while doing lookup for datasource .we have recently migrated to weblogic 12c from weblogic 11. Below is the code via which I am looking up for Datasource .
ds = (javax.sql.DataSource) ctx.lookup("my_data_source_name");
this code is giving class cast exception
Caused by: java.lang.ClassCastException: weblogic.jndi.internal.WLEventContextImpl cannot be cast to javax.sql.DataSource
we have weblogic.jar in our class path .. i am not sure why it is returning the object of type WLEventContextImpl instead of Datasource . Can someone suggest something?
Upvotes: 0
Views: 4139
Reputation: 120
I had this problem and in my case I created a datasource without associate with a target, in the last page of datasource configuration you can see:
Select Targets:
Servers
[ ] AdminServer
After I check the AdminServer checkbox, I could use the datasource.
Upvotes: 1