[Date Prev][Date Next] [Chronological] [Thread] [Top]

Openldap + JNDI questions



Hi,  I am new to LDAP and JNDI, but have read up some literature and
installed OpenLdap on my linux machine.  I am trying to set up
configuration in which i can add objects to the LDAP directory using
JNDI.. so, i've gone ahead and made the following slapd.conf file:

database        ldbm
suffix          "o=LDAPTest"
rootdn          "cn=Manager,o=LDAPTest"
schemacheck     off
directory       /usr/local/var/openldap-ldbm


Now, in my java code, i have:

       Hashtable env = new Hashtable();

        env.put( Context.INITIAL_CONTEXT_FACTORY,
                 "com.sun.jndi.ldap.LdapCtxFactory" );
        env.put( Context.PROVIDER_URL, "ldap://localhost/o=LDAPTest"; );

        try {
            DirContext ctx = new InitialDirContext( env );

            String name = "myData";
            ctx.bind( "cn=" + name.toString(), name );

            //      System.out.println( name + " is bound to " + obj );

        } catch ( Exception e ) {
            System.err.println( e );
        }

The code compiles fine.. and it seems like it connects to the LDAP server
correctly as well.. but upon execution, i get the following exception
thrown:
javax.naming.NameNotFoundException: [LDAP: error code 32 - parent does not
exist]; remaining name 'cn=foo'

I can't figure out why this might be... any gurus want to take a shot at
this one?  Any help is appreciated, thanks!
 -ani.