title: Spring data Ldap Repository return empry List when findAll is used
body: <p>I trying to integrate ldap with spring using </p>
  
  <pre><code>&lt;dependency&gt;
              &lt;groupId&gt;org.springframework.ldap&lt;/groupId&gt;
              &lt;artifactId&gt;spring-ldap-core&lt;/artifactId&gt;
              &lt;version&gt;2.3.2.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
              &lt;artifactId&gt;spring-data-ldap&lt;/artifactId&gt;
              &lt;version&gt;2.1.5.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  </code></pre>
  
  <p>I am trying to fetch all users i have in our test Ldap Server, but when i use findAll method of LdapRepository interface all i get is an empty list. I have read a lot in Internet , a lot of docs but i have not found what is going wrong with this task i am trying to do.</p>
  
  <p>Here is some code samples:
  Config file:</p>
  
  <pre><code>@Configuration
  @PropertySource("classpath:application.yaml")
  @EnableLdapRepositories(basePackages = "gr.mpass.aia.ldap")
  public class AppConfig {
  
      @Autowired
      private Environment env;
  
      @Bean
      public LdapContextSource contextSource() {
          LdapContextSource contextSource = new LdapContextSource();
          contextSource.setUrl(env.getRequiredProperty("ldap.url"));
          contextSource.setUserDn(env.getRequiredProperty("ldap.principal"));
          contextSource.setPassword(env.getRequiredProperty("ldap.password"));
          return contextSource;
      }
  
      @Bean
      public LdapTemplate ldapTemplate() {
          return new LdapTemplate(contextSource());
      }
  
      @Bean
      public LdapClientService ldapClient() {
          return new LdapClientService();
      }
  
  }
  </code></pre>
  
  <p>Entry Class:</p>
  
  <pre><code>@Entry(base = "cn=eshop,ou=mpass,cn=admin,dc=userlogin,dc=mpass,dc=ltd", objectClasses = { "posixGroup", "inetOrgPerson", "top" })
  public class LdapUser {
  
      @Id
      private Name id;
  
      private @Attribute(name = "cn") String fullName;
      private @Attribute(name = "mail") String email;
      private @Attribute(name = "uidNumber") String uidNumber;
  
      public LdapUser() {
      }
  
      public LdapUser(String fullName, String email, String uIdNumber) {
          this.fullName = fullName;
          this.email = email;
          this.uidNumber = uidNumber;
      }
  
      public Name getId() {
          return id;
      }
  
      public void setId(Name id) {
          this.id = id;
      }
  
      public String getFullName() {
          return fullName;
      }
  
      public void setFullName(String fullName) {
          this.fullName = fullName;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String password) {
          this.email = email;
      }
  
      public String getUidNumber() {
          return uidNumber;
      }
  
      public void setUidNumber(String uidNumber) {
          this.uidNumber = uidNumber;
      }
  
      @Override
      public String toString() {
          return fullName;
      }
  
  }
  </code></pre>
  
  <p>Repository:</p>
  
  <pre><code>@Repository
  public interface LdapUserRepository extends LdapRepository&lt;LdapUser&gt; {
  
      LdapUser findByFullName(String fullName);
  
      LdapUser findByEmail(String email);
  
      LdapUser findByUidNumber(String uidNumber);
  
      List&lt;LdapUser&gt; findByEmailLikeIgnoreCase(String email);
  
      List&lt;LdapUser&gt; findByEmailNotLike(String email);
  
  }
  </code></pre>
  
  <p>Fetch users query:</p>
  
  <pre><code>  LdapQuery query = query().base("cn=eshop,ou=mpass,cn=admin,dc=userlogin,dc=mpass,dc=ltd")
                  .searchScope(SearchScope.ONELEVEL)
                  .where("objectclass").is("inetOrgPerson");
          Iterable&lt;LdapUser&gt; ldapUsers = ldapUserRepository.findAll(query);
  </code></pre>
  
  <p>This returns an empty list.</p>
  
  <p>I tried ldapUserRepository.findAll() without a parameter but it doesn't work. It says javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object].</p>
  
  <p>I tried this answer <a href="https://stackoverflow.com/a/48384297/1501205">https://stackoverflow.com/a/48384297/1501205</a> but it doesnt help at all.</p>
  
  <p>Any help would be appreciated.
  Thanks in advance
  Here a printscreen of the Ldap server tree:
  <a href="https://i.stack.imgur.com/1MA6f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1MA6f.png" alt="enter image description here"></a></p>