sexta-feira, 27 de fevereiro de 2015

Sizelimit Exceeded OpenLDAP

Veja a versão em português

Hello my friends,

Today I had this problem in my Java project when I tried do a search in OpenLDAP:
2015-02-26 16:44:04,875 ERROR [br.com.localhost8080.ldap.MyClass] Sizelimit Exceeded
LDAPException: Sizelimit Exceeded (4) Sizelimit Exceeded

LDAPException: Matched DN:
at com.novell.ldap.LDAPResponse.getResultException(Unknown Source)
at com.novell.ldap.LDAPResponse.chkResultCode(Unknown Source)
at com.novell.ldap.LDAPSearchResults.next(Unknown Source)
at br.com.localhost8080.ldap.LdapSynchronizer.synchronize(LdapSynchronizer.java:84)

It happens because the OpenLDAP had 1500 users... and the default sizelimit in my Java client was 1000.

Changing the parameter sizelimit at slapd.conf in OpenLDAP doesn't solve the problem.

To solve this I used the class com.novell.ldap.LDAPSearchConstraints like this:
LDAPSearchConstraints ldsc = new LDAPSearchConstraints();
ldsc.setMaxResults(0);

connection.search(searchBase, searchScope, searchFilter, new String[] {}, false, ldsc);
Setting the MaxResults with 0 (zero) the sizelimit becomes unlimited.

Best Regards,
Adriano Schmidt

Nenhum comentário:

Postar um comentário