添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
鬼畜的山羊  ·  javascript Uint8Array ...·  1 年前    · 
买醉的沙滩裤  ·  Spring Data JPA and ...·  1 年前    · 
忐忑的钢笔  ·  jchsinker-java去重写click ...·  2 年前    · 
不羁的围巾  ·  vbnet生成exe-掘金·  2 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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

Ask Question

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

The server is telling you that you've asked for too much data. You need to refine your search so that it asks for less results. – Anya Shenanigans Oct 24, 2013 at 9:30 Verify your assumption that is the case by examining the actual traffic returned from the server e.g. by using wireshark on the client system – Anya Shenanigans Oct 24, 2013 at 10:09

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

  • LDAP: Mastering Search Filters
  • LDAP: Search best practices
  • LDAP: Programming practices
  • Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.