JBoss Community

JNDI lookup fails in Filter/Servlet's init() method

created by abiya in JNDI and Naming - View the full discussion

Hi,

 

I am able to perform JNDI lookup using the following code in my servlet,

 

DataSource ds = null;

Context ctx = null;

try {

        String strDSName = "java:jboss/datasources/Test";

        ctx = new InitialContext();

        ds = (javax.sql.DataSource) ctx.lookup(strDSName);

} catch (Exception e) {

}

 

I need to have lookup from servlet and filter's init() method which looks like a problem. It throws javax.naming.NameNotFoundException. Any input on this would be of great help.

 

Thanks,

Abiya

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community