Announcement Announcement Module
No announcement yet. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts



    I am using spring-ldap-1.3.0.
    I am trying to find entries in an OpenDS ldap server.
    I referred the following method from Spring ldap api
    public List search(Name base,
    String filter,
    ContextMapper mapper)

    The code snippet I use is as follows

       PersonLP4LDAP person = null;
                List<PersonLP4LDAP> people ="", "uid=328996863458585, ou=xxx, o=xxx, o=cp" ,
                        new PersonContextMapper());
                if (people.size() > 0)
                    person = (PersonLP4LDAP) people.iterator().next();
            return person;
    The Spring configuration file is as follows
    <bean id="contextSourceLP4"
            <property name="url" value="ldap://tsetsserver:389" />
            <property name="base" value="o=cp" />
            <property name="userDn" value="Directory Manager" />
            <property name="password" value="pswd" />
        <bean id="ldapTemplateLP4" class="org.springframework.ldap.core.LdapTemplate">
            <constructor-arg ref="contextSourceLP4" />
    with this set up Ia m getting the org.springframework.ldap.NameNotFoundException: [LDAP: error code 32 - No Such Object]

    Can you please suggest me wht is the exact parameter I need to pass to the search method?
    I need to get the uid entries from the LDAP.I have passed the entire root to search method.I have not passed the basedn as parameter to search method.
    Kindly help me solve the problem ASAP

  • #2
    You have specified a base in your configuration.

    <property name="base" value="o=cp" />
    That means you should not use that part in your search base. Also, you have mixed up the search base and the filter, I think. If you want to search for all occurrences of "uid=328996863458585", starting from "ou=xxx, o=xxx", then it should look something like this:

    List<PersonLP4LDAP> people ="ou=xxx, o=xxx", "(uid=328996863458585)", mapper);
    If you know the complete path (distinguished name) to the entry, you should instead perform a lookup:

    PersonLP4LDAP person = ldapTemplateLP4.lookup("uid=328996863458585, ou=xxx, o=xxx", mapper);
    Note that the lookup path as well as the search base should not contain the configured base.
    Last edited by ulsa; May 5th, 2010, 10:09 AM. Reason: Forgot some code tags


    • #3
      Thank you very much for your suggestion.
      It worked.