This discussion is archived
0 Replies Latest reply: Jun 14, 2013 1:35 PM by jason-bluebox RSS

iPlanet, LDAP, and JNDI

jason-bluebox Newbie
Currently Being Moderated

I am having problems creating a JNDI Resource lookup using iPlanet 7.0u15.

 

I created the following resource.

 

---

 

RESOURCE

Resource Name: ldap/ldapsearch

Resource Type: javax.naming.ldap.LdapContext

Resource Factory Class: com.sun.jndi.ldap.LdapCtxFactory

External JNDI Name: ldapsearch

 

PROPERTIES

java.naming.security.authentication=simple

java.naming.referral=follow

java.naming.security.principal=cn=Directory Manager

java.naming.security.credentials=abc123

java.naming.provider.url=ldap://XXXX:389/ou=People,o=company.com

 

---

 

After I did this, I updated my web.xml with the following.

 

  <resource-ref>

    <description>DB Connection</description>

    <res-ref-name>ldap/ldapsearch</res-ref-name>

    <res-type>javax.naming.ldap.LdapContext</res-type>

    <res-auth>Container</res-auth>

  </resource-ref>

 

Then, I created a sun-web.xml (because everybody says I have to for iPlanet context lookup).

 

<sun-web-app>

    <resource-ref>

        <res-ref-name>ldap/ldapsearch</res-ref-name>

        <jndi-name>ldap/ldapsearch</jndi-name>

    </resource-ref>

</sun-web-app>

 

In my Java code, I do the following:

 

InitialContext searchctx = new InitialContext();

DirContext ctx = (javax.naming.ldap.LdapContext) searchctx.lookup("java:/comp/env/ldap/ldapsearch");

 

I check the logs and I see the following error:

 

LDAP: error code 34 - invalid DN


The resource in iPlanet is correct because I use the credentials from "LDAP Brower" windows application and I have used the credentials from the command-line using the CLI ldapsearch with no problems.  What gives?


Anybody know what I am doing wrong here?!?