Results 1 to 3 of 3

Thread: Lookup results with net.sf.ldaptemplate.EntryNotFoundException

  1. #1
    Join Date
    Jul 2005
    Location
    Zagreb, Croatia
    Posts
    69

    Default Lookup results with net.sf.ldaptemplate.EntryNotFoundException

    Hello all!

    I have a bit of a problem with the ldapTemplate lookup and search methods.

    This is my context:

    Code:
    <bean id="contextSource" class="net.sf.ldaptemplate.support.LdapContextSource">
    		<property name="url" value="ldap://localhost:389"/>
    		<property name="userName" value="cn=user"/>
    		<property name="base" value=" ou=admins,ou=teamadmin,O=TEAM.SI,C=SI"/>
    		<property name="password" value="password"/>
    		<property name="authenticatedReadOnly" value="true"/>
    	</bean>
    In my LDAP (v3) I have the following entry:
    Code:
    uid=admin,ou=admins,ou=teamadmin, o=TEAM.SI, c=SI
    When I try:
    Code:
    LdapUser ldapUser = (LdapUser)m_ldapTemplate.lookup("uid=" + p_username + "," + m_searchBase, mapper);
    
    //where m_searchBase== "ou=admins,ou=teamadmin,O=TEAM.SI,C=SI"
    i get the net.sf.ldaptemplate.EntryNotFoundException.
    Stack:

    Code:
    net.sf.ldaptemplate.EntryNotFoundException: Entry not found; nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'uid=admin,ou=admins,ou=olpadmin,O=AMEX.HR,C=HR'
    javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'uid=admin,ou=admins,ou=olpadmin,O=AMEX.HR,C=HR'
    	at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3013)
    	at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2934)
    	at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2740)
    	at com.sun.jndi.ldap.LdapCtx.c_getAttributes(LdapCtx.java:1294)
    	at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:213)
    	at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:121)
    	at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:109)
    	at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:121)
    	at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:116)
    	at net.sf.ldaptemplate.LdapTemplate$6.executeWithContext(LdapTemplate.java:464)
    	at net.sf.ldaptemplate.LdapTemplate.executeWithContext(LdapTemplate.java:408)
    	at net.sf.ldaptemplate.LdapTemplate.executeReadOnly(LdapTemplate.java:395)
    	at net.sf.ldaptemplate.LdapTemplate.lookup(LdapTemplate.java:461)
    Ideas?

    Thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    When you are specifying a base path in your ContextSource configuration all operations will be relative to this path, which means that you should remove the base path from the dn in your lookup.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  3. #3
    Join Date
    Jul 2005
    Location
    Zagreb, Croatia
    Posts
    69

    Default Work fine now

    Thanks rasky, it helped.
    Seems i haven't been reading the docs with enough attention
    cheers!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •