超出LDAPException大小限制

超出LDAPException大小限制,ldap,ldap-query,ldapconnection,unboundid-ldap-sdk,Ldap,Ldap Query,Ldapconnection,Unboundid Ldap Sdk,我正在使用未绑定的ldap sdk执行ldap查询。我在运行ldap搜索查询时遇到了一个奇怪的问题。当我对一个包含50k条目的组运行查询时,我遇到了一个异常。我的例外: LDAPException(resultCode=4 (size limit exceeded), errorMessage='size limit exceeded') at com.unboundid.ldap.sdk.migrate.ldapjdk.LDAPSearchResults.nextElement(LDAPSea

我正在使用未绑定的ldap sdk执行ldap查询。我在运行ldap搜索查询时遇到了一个奇怪的问题。当我对一个包含50k条目的组运行查询时,我遇到了一个异常。我的例外:

LDAPException(resultCode=4 (size limit exceeded), errorMessage='size limit exceeded')
at com.unboundid.ldap.sdk.migrate.ldapjdk.LDAPSearchResults.nextElement(LDAPSearchResults.java:254)
at com.unboundid.ldap.sdk.migrate.ldapjdk.LDAPSearchResults.next(LDAPSearchResults.java:279)
现在奇怪的是,我已经在搜索约束中将maxResultSize设置为100k,而不是为什么会出现这个错误? 我的代码是

     ld = new LDAPConnection();
    ld.connect(ldapServer, 389);

    LDAPSearchConstraints ldsc = new LDAPSearchConstraints();
    ldsc.setMaxResults(100000);
    ld.setSearchConstraints(ldsc);

有人知道吗?

检查服务器端大小限制设置。它优先于客户端设置,而客户端设置正是您在代码中所做的。

检查服务器端大小限制设置。它优先于客户端设置,客户端设置是您在代码中所做的。

很抱歉,您发布的主题没有答案,但仍然是google中的第一个主题

使用unbounded实际上可以在分页模式下获得无限数量的记录

public static void main(String[] args) {

try {
    int count = 0;
    LDAPConnection connection = new LDAPConnection("hostname", 389, "user@domain", "password");

    final String path = "OU=Users,DC=org,DC=com";
    String[] attributes = {"SamAccountName","name"};

    SearchRequest searchRequest = new SearchRequest(path, SearchScope.SUB, Filter.createEqualityFilter("objectClass", "person"), attributes);

    ASN1OctetString resumeCookie = null;
    while (true)
    {
        searchRequest.setControls(
                new SimplePagedResultsControl(100, resumeCookie));
        SearchResult searchResult = connection.search(searchRequest);
        for (SearchResultEntry e : searchResult.getSearchEntries())
        {
            if (e.hasAttribute("SamAccountName"))
                System.out.print(count++ + ": " + e.getAttributeValue("SamAccountName"));

            if (e.hasAttribute("name"))
                System.out.println("->" + e.getAttributeValue("name"));
        }

        LDAPTestUtils.assertHasControl(searchResult,
                SimplePagedResultsControl.PAGED_RESULTS_OID);
        SimplePagedResultsControl responseControl =
                SimplePagedResultsControl.get(searchResult);
        if (responseControl.moreResultsToReturn())
        {
            resumeCookie = responseControl.getCookie();
        }
        else
        {
            break;
        }
    }


}
catch (Exception e)
{
    System.out.println(e.toString());
}

}

很抱歉发了这么多帖子,但是你没有答案的主题仍然是谷歌的第一个主题

使用unbounded实际上可以在分页模式下获得无限数量的记录

public static void main(String[] args) {

try {
    int count = 0;
    LDAPConnection connection = new LDAPConnection("hostname", 389, "user@domain", "password");

    final String path = "OU=Users,DC=org,DC=com";
    String[] attributes = {"SamAccountName","name"};

    SearchRequest searchRequest = new SearchRequest(path, SearchScope.SUB, Filter.createEqualityFilter("objectClass", "person"), attributes);

    ASN1OctetString resumeCookie = null;
    while (true)
    {
        searchRequest.setControls(
                new SimplePagedResultsControl(100, resumeCookie));
        SearchResult searchResult = connection.search(searchRequest);
        for (SearchResultEntry e : searchResult.getSearchEntries())
        {
            if (e.hasAttribute("SamAccountName"))
                System.out.print(count++ + ": " + e.getAttributeValue("SamAccountName"));

            if (e.hasAttribute("name"))
                System.out.println("->" + e.getAttributeValue("name"));
        }

        LDAPTestUtils.assertHasControl(searchResult,
                SimplePagedResultsControl.PAGED_RESULTS_OID);
        SimplePagedResultsControl responseControl =
                SimplePagedResultsControl.get(searchResult);
        if (responseControl.moreResultsToReturn())
        {
            resumeCookie = responseControl.getCookie();
        }
        else
        {
            break;
        }
    }


}
catch (Exception e)
{
    System.out.println(e.toString());
}

}

哪个LDAP服务器供应商?哪个LDAP服务器供应商?