Hi
<br>I am trynig to connect to the Data Source throuh the indirect method [b]java:comp/env with Weblogic 10.3[/b] with the [b]DataSource name "testJNDI"[/b]
<br>
<br>The below code is running fine in Websphere but am unable to connect through weblogic.
<br>
<br>Below is my code..
<br>
<br>
try
<br>
{
<br>
Context ct = new InitialContext();
<br>
<br> Object o = ct.lookup("java:comp/env");
<br> Context ctx1 = (Context) o;
<br> DataSource ds1 = (DataSource) ctx1.lookup("testJDNI");
<br> Connection con2 = ds1.getConnection();
<br> out.println("DB connected for JNDI =>testJDNI ");
<br> con2.close();
<br>}
<br>catch (Exception e)
<br>{
<br> out.println(" Exception ==>"+e);
<br>}
<br>
[i]<br>[b]Also in web.xml have defined the resource-ref[/b]<br>[/i]
<br><br><resource-ref>
<br><br> <res-ref-name>testJNDI</res-ref-name>
<br><br> <res-type>javax.sql.DataSource</res-type>
<br><br> <res-auth>Container</res-auth>
<br><br> <res-sharing-scope>Shareable</res-sharing-scope><br>
<br></resource-ref><br><br>
<br>While executing am getting the following below exception
<br>
<br>[i][b]javax.naming.NameNotFoundException: While trying to look up testJDNI in java:comp/env.; remaining name 'testJDNI'[/b][/i]
<br>
<br>
Please let me know why I am unable to connect to the data source.. As through Direct
lookup method Data Source is getting connected..[i][/i]
[Message sent by forum member 'manu_mishra']
http://forums.java.net/jive/thread.jspa?messageID=470249