> But when I try to access my resource with the following code:
>
> Context newCtx = null;
> try {
> newCtx = new InitialContext();
> } catch (NamingException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> try {
> DirContext ctx = (DirContext) newCtx.lookup("blah");
> if (ctx != null){
> System.out.println ("Success");
> } else {
> System.out.println ("False");
> }
>
> Then lookup java:comp/env/blah
You should also have a matching entry in web.xml, e.g.
<resource-ref>
<res-ref-name>blah</res-ref-name>
<res-type>com.sun.jndi.ldap.LdapCtx</res-type>
<res-auth>Container</res-auth>
</resource-ref>
HTH
Chris