netscape.ldap.LDAPException: error result (4); Sizelimit exceeded, when using netscape.jar in Java

StackOverflow https://stackoverflow.com/questions/19561918

  •  01-07-2022
  •  | 
  •  

문제

I am getting following exception while searching LDAP in Java. It fetches many records but in the last it throws following exception.

netscape.ldap.LDAPException: error result (4); Sizelimit exceeded
    at netscape.ldap.LDAPConnection.checkMsg(LDAPConnection.java:4880)
    at netscape.ldap.LDAPConnection.checkSearchMsg(LDAPConnection.java:2638)
    at netscape.ldap.LDAPSearchResults.fetchResult(LDAPSearchResults.java:548)
    at netscape.ldap.LDAPSearchResults.hasMoreElements(LDAPSearchResults.java:456)

I have tried following options.

1.getConnection().setOption(LDAPv2.SIZELIMIT,new Integer(0));
  getConnection().setOption(LDAPv2.TIMELIMIT,new Integer(0));


2. LDAPSearchConstraints ldapSearchConst = getConnection().getSearchConstraints();
   ldapSearchConst.setMaxResults(-1);
   ldapSearchConst.setTimeLimit(-1);

3. Both 1 and 2 together

Only the number of records returned are different for above options but the exception doesn't go away.Can anybody help me on this. Lot of thanks

도움이 되었습니까?

해결책

From RFC4511:

A size limit that restricts the maximum number of entries to be returned as a result of the Search. A value of zero in this field indicates that no client-requested size limit restrictions are in effect for the Search. Servers may also enforce a maximum number of entries to return.

The size limit in #1 is the client-requested size limit, which cannot override the server-side time limit, referenced in the above quote from RFC4511. No matter what value the client-requested time limit contains, that value cannot override the server enforcement.

see also

다른 팁

Your filter returns more records than the expected maximum number of records.

Either you should narrow down or refine your search or you can increase the maximum fetch size in the ldap server. (You need to override the default value).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top