相关疑难解决方法(0)

如何解决javax.naming.PartialResultException?

我们在日志中看到此警告消息

javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name 'dc=global,dc=com'

每当用户登录我们的应用程序时,它就会出现.

根据这篇SO帖子,可以通过设置Context.REFERRAL来解决它follow.但它将搜索时间从1秒增加到4秒.

实际上你可以参考这篇SO帖子,它说使用follow会减慢搜索速度.

所以我的问题是,在不影响性能的情况下,从日志中删除此异常的最佳方法是什么?

ldap

35
推荐指数
2
解决办法
5万
查看次数

Spring的LdapTemplate搜索:PartialResultException:未处理的Continuation Reference(s); 剩余名称'/'

我通过LDAP为特定应用程序添加用户,使用spring制作.

虽然这适用于大多数情况,但在某些情况下,它不起作用......

检索我使用的用户:

public class LdapUserServiceImpl implements ILdapUserService {

    @Override
    public List<LdapUserVO> getUserNamesByQuery(String query) {
        return ldapTemplate.search(
            query().countLimit(15)
                    .where("objectClass").is("user")
                    .and("sAMAccountName").isPresent()
                    .and(query()
                            .where("sAMAccountName").like("*" + query + "*")
                            .or("sAMAccountName").is(query)
                            .or("displayName").like("*" + query + "*")
                            .or("displayName").is(query))
            ,
            new AttributesMapper<LdapUserVO>() {
                public LdapUserVO mapFromAttributes(Attributes attrs) throws NamingException {
                    LdapUserVO ldapUser = new LdapUserVO();
                    Attribute attr = attrs.get(ldapUserSearch);
                    if (attr != null && attr.get() != null) {
                        ldapUser.setUserName(attr.get().toString());
                    }
                    attr = attrs.get("displayName");
                    if (attr != null && attr.get() != null) {
                        ldapUser.setDisplayName(attr.get().toString());
                    }
                    return ldapUser; …
Run Code Online (Sandbox Code Playgroud)

spring ldap ldap-query spring-ldap ldap-client

4
推荐指数
1
解决办法
7111
查看次数

ldap搜索非常慢

我正在使用JNDI连接到LDAP活动目录,我想搜索名称中包含搜索字符串的用户,所以我的搜索方法如下:

public static List<LDAPUser> searchContactsByName(
        ExtendedDirContext extendedDirContext, String name) {

    try {

        LdapContext ldapContext = extendedDirContext.getLdapContext();
        String searchBaseStr = extendedDirContext.getSearchBase();

        String sortKey = LDAPAttributes.NAME;
        ldapContext.setRequestControls(new Control[] { new SortControl(
                sortKey, Control.CRITICAL) });

        SearchControls searchCtls = new SearchControls();
        searchCtls.setTimeLimit(1000 * 10);

        String returnedAtts[] = { LDAPAttributes.USER_NAME,
                LDAPAttributes.NAME };
        searchCtls.setReturningAttributes(returnedAtts);

        searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);

        String searchFilter = "(&(ObjectCategory=person)(cn=*" + name
                + "*))";

        NamingEnumeration<SearchResult> results = ldapContext.search(
                searchBaseStr, searchFilter, searchCtls);

        List<LDAPUser> users = new ArrayList<LDAPUser>(0);
        while (results.hasMoreElements()) {
            SearchResult sr = (SearchResult) results.next();
            Attributes attrs = …
Run Code Online (Sandbox Code Playgroud)

java jndi ldap active-directory

2
推荐指数
1
解决办法
1万
查看次数