title: Spring embedded ldap server Unable to perform the search
body: <p>I am getting below error while using spring embedded ldap server.</p>
  
  <p>Your login attempt was not successful, try again.</p>
  
  <blockquote>
    <p>Reason: [LDAP: error code 32 - Unable to perform the search because base entry 'ou=people,dc=example,dc=com' does not exist in the server.]; nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - Unable to perform the search because base entry 'ou=people,dc=example,dc=com' does not exist in the server.]; remaining name 'ou=people'</p>
  </blockquote>
  
  <p><strong>Below are my code</strong></p>
  
  <pre><code>&lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.ldap&lt;/groupId&gt;
              &lt;artifactId&gt;spring-ldap-core&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-ldap&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.unboundid&lt;/groupId&gt;
              &lt;artifactId&gt;unboundid-ldapsdk&lt;/artifactId&gt;
          &lt;/dependency&gt; &lt;!-- This is the ldap server--&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
      dn: ou=groups,dc=example,dc=com
      objectclass: top
      objectclass: organizationalUnit
      ou: groups
  
      dn: ou=people,dc=example,dc=com
      objectclass: top
      objectclass: organizationalUnit
      ou: people
  
      dn: uid=vandna,ou=people,dc=example,dc=com
      objectclass: top
      objectclass: person
      objectclass: organizationalPerson
      objectclass: inetOrgPerson
      cn: vandna bhimjiyani
      sn: bhimjiyani
      uid: vandna
      userPassword: password
  
      dn: uid=kaushik,ou=people,dc=example,dc=com
      objectclass: top
      objectclass: person
      objectclass: organizationalPerson
      objectclass: inetOrgPerson
      cn: kaushik andani
      sn: andani
      uid: kaushik
      userPassword: password
  
      dn: cn=user,ou=groups,dc=example,dc=com
      objectclass: top
      objectclass: groupOfNames
      cn: user
      uniqueMember: uid=vandna,ou=people,dc=example,dc=com
  
      dn: cn=admin,ou=groups,dc=nascent,dc=com
      objectclass: top
      objectclass: groupOfNames
      cn: admin
      uniqueMember: uid=kaushik,ou=people,dc=example,dc=com
  </code></pre>
  
  <p><strong>in WebSecurityConfigurerAdapter</strong></p>
  
  <pre><code>@Override
  protected void configure(AuthenticationManagerBuilder auth) throws Exception {
              auth.ldapAuthentication()
                      .userSearchBase("ou=people")
                      .userSearchFilter("(uid={0})").groupSearchBase("ou=groups")
                      .groupSearchFilter("(member={0})")
                      .contextSource().root("dc=nascent,dc=com")
                      .ldif("src/main/resources/users.ldif");
          }
  </code></pre>