[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
OpenLDAP with JNDI : java.naming.NameNotFoundException
Hi all,
I have installed OpenLDAP on a NT server 4.0, and was able to run it and do
ldapsearch, and slapadd to the directory.
I am now trying to use JNDI API to access the directory data. I was able to
do a search.
But when I used the JNDi API to get
attributes: ----------------------------------------------------------------
-----------
........
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389");
String attrs[] = new String[1];
DirContext ctx=new InitialDirContext(env);
Attributes attr= ctx.getAttributes("cn=BB" attrs);
........................
whenever I run
java Getattrs
I get the following errors:
Getattrs example failed
java.naming.NameNotFoundException: [LDAP error code 32 - No Such Object];
remaining name 'cn=BB
at com.jndi.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:2680)
at com.jndi.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2601)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2411)
at com.sun.jndi.ldap.LdapCtx.c_getAttributes(LdapCtx.java:1078)
at
com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirCon
text.java:216)
at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCom
positeDirContext.java:124)
at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCom
positeDirContext.java:112)
at
javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.jav
a:124)
at Getattrs.main(Getattrs.java:77)
It compiles fine when I use ctx.search("c=DE"); and displays the expected
result.....
I am not sure if the problem is with getAttributes() method OR SOMETHING
ELSE.
Can anyone please help me out???
thanks in advance.
Susmitha.