[jboss-user] [JNDI and Naming] - JNDI lookup fails in Filter/Servlet's init() method

abiya do-not-reply at jboss.com
Mon Nov 28 06:07:26 EST 2011


abiya [http://community.jboss.org/people/abiya] created the discussion

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

To view the discussion, visit: http://community.jboss.org/message/638609#638609

--------------------------------------------------------------
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
[http://community.jboss.org/message/638609#638609]

Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111128/db82f74d/attachment.html 


More information about the jboss-user mailing list