Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring LDAP:将countLimit设置为1时,错误代码4-超出了Sizelimit_Java_Ldap_Spring Ldap - Fatal编程技术网

Java Spring LDAP:将countLimit设置为1时,错误代码4-超出了Sizelimit

Java Spring LDAP:将countLimit设置为1时,错误代码4-超出了Sizelimit,java,ldap,spring-ldap,Java,Ldap,Spring Ldap,使用SpringLDAP 1.3.1时,我试图读取LDAP的内容,但出现以下错误: LDAP:错误代码4-超出了Sizelimit 在搜索如何限制结果大小后,我发现类SearchControls对此负责 现在我的代码如下所示: SearchControls controls = new SearchControls(); controls.setCountLimit(1); ContextMapper mapper = new ContextMapper() { public Obje

使用SpringLDAP 1.3.1时,我试图读取LDAP的内容,但出现以下错误:

LDAP:错误代码4-超出了Sizelimit

在搜索如何限制结果大小后,我发现类
SearchControls
对此负责

现在我的代码如下所示:

SearchControls controls = new SearchControls();
controls.setCountLimit(1);
ContextMapper mapper = new ContextMapper() {

    public Object mapFromContext(Object ctx) {
        DirContextAdapter adapter = (DirContextAdapter) ctx;
        Attributes attrs = adapter.getAttributes();
        try {
            return attrs.get("cn").get();
        } catch (NamingException e) {
            e.printStackTrace();
            return null;
        }
    }
};
return ldapTemplate.search("OU=system,DC=de", "(objectclass=person)", controls, mapper);
但仍然会抛出相同的错误。因此,似乎忽略了count limit参数(在加载依赖项源之后,我在Eclipse中找不到对
getCountLimit()
的引用)


所以我的问题是,我应该如何使用SpringLDAP设置LDAP查询的大小限制?

您提到的大小限制是“客户端请求的”大小限制。无论客户机将该值设置为什么,它都无法覆盖服务器的大小限制资源限制。专业质量的服务器可以通过多种方式限制返回的条目数量,也许您的客户机遇到了其中一个限制

另见

如果设置大小限制,服务器将限制该值的响应数量。但是,如果实际上有更多的响应可以返回,如果/当您尝试迭代超过限制时,您将得到该异常

引述:

在另一个示例中,如果使用指定的 “n”的大小限制。如果答案包含多个“n”个结果, search()将首先返回一个namingumeration。第n个结果是什么时候 已通过调用NamingEnumeration上的next()返回 调用hasMore()时,将引发SizeLimitExceedException

1) 您可以在服务器大小上更改/etc/openldap/slapd.conf中的sizelimit参数。更多信息可以在这里找到


2) 或者您可以像等式一样限制您的查询。这里

我肯定LDAP服务器上有限制,但是如何使用Spring LDAP和/或Java中LDAP的查询语法限制查询大小?