title: Caused by: java.lang.ClassCastException: weblogic.jndi.internal.WLEventContextImpl cannot be cast to javax.sql.DataSource
body: <p>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 .</p>
  
  <pre><code>        ds = (javax.sql.DataSource) ctx.lookup("my_data_source_name");
  </code></pre>
  
  <p>this code is giving class cast exception </p>
  
  <p>Caused by: java.lang.ClassCastException: weblogic.jndi.internal.WLEventContextImpl cannot be cast to javax.sql.DataSource</p>
  
  <p>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?</p>