users@glassfish.java.net

NameNotFound exception - makes no sense ?!

From: Mon Cab <futon33_at_yahoo.com>
Date: Mon, 31 Mar 2008 22:55:56 -0700 (PDT)

This is wierd

I have exacly the same code in two different classes, in the same
package, each getting the same JNDI resource, as follows:

Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:comp/env");
DataSource ds = (DataSource)initContext.lookup("jdbc/myDatasource");
Connection con = ds.getConnection();

The first class is called and gets a connection, with no problem, then
the second class, which uses exaclty the same code to get the
connection gets:

No object bound to name java:comp/env/jdbc/myDatasource

exception.

What is going on here?



      ____________________________________________________________________________________
OMG, Sweet deal for Yahoo! users/friends:Get A Month of Blockbuster Total Access, No Cost. W00t
http://tc.deals.yahoo.com/tc/blockbuster/text2.com