dcsimg
datasource jndi lookup question
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   German_Reyes
Posted On:   Monday, April 29, 2002 12:43 AM

I'm trying to lookup a datasource from a java class that IS NOT AN EJB. (The code is the one of the DAO pattern provided by SUN microsystem). I'm getting a javax.naming.NameNotFoundException: Missing Node when I'm trying to lookup inside OrderDAOImpl public class OrderDAOImpl implements OrderDAO { protected transient Connection dbConnection = null; private transient DataSource datasource = null; public OrderDAOImpl() throws OrderDAOSysException { try { InitialContext ic = new InitialContext(); datasource = (DataSource) ic.lookup(JNDINames.ESTORE_DATASOURCE); } catch (NamingExcept   More>>

I'm trying to lookup a datasource from a java class that IS NOT AN EJB. (The code is the one of the DAO pattern provided by SUN microsystem).


I'm getting a javax.naming.NameNotFoundException: Missing Node when I'm trying to lookup inside OrderDAOImpl


public class OrderDAOImpl implements OrderDAO {


protected transient Connection dbConnection = null;


private transient DataSource datasource = null;


public OrderDAOImpl() throws OrderDAOSysException {


try {


InitialContext ic = new InitialContext();


datasource = (DataSource) ic.lookup(JNDINames.ESTORE_DATASOURCE);


}


catch (NamingException ne) {


throw new OrderDAOSysException("NamingException while looking" +
" up DataSource Connection " +
JNDINames.ESTORE_DATASOURCE +
":
" + ne.getMessage());


}


}
...


}


I can see the datasource from within an EJB, but how can I do the same thing from the class mentioned above?



Thanks in advance

   <<Less

Re: datasource jndi lookup question

Posted By:   Bozidar_Dangubic  
Posted On:   Monday, April 29, 2002 06:03 AM

probably because of the Context. where does this class get loaded? how creates and invokes this class? is it loaded from the client (is this client code) or this is a helper class inside the EJB container?
About | Sitemap | Contact