Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/308.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 使用SpringLDAP验证用户时发生异常_Java_Spring_Ldap_Spring Ldap - Fatal编程技术网

Java 使用SpringLDAP验证用户时发生异常

Java 使用SpringLDAP验证用户时发生异常,java,spring,ldap,spring-ldap,Java,Spring,Ldap,Spring Ldap,我在验证用户时遇到以下异常: Exception in thread "main" org.springframework.ldap.PartialResultException: Unprocessed Continuation Reference(s); nested exception is javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name '/' a

我在验证用户时遇到以下异常:

Exception in thread "main" org.springframework.ldap.PartialResultException: Unprocessed Continuation Reference(s); nested exception is javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name '/'
    at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:205)
验证方法:

public boolean authenticate(String userName, String password) {
        AndFilter filter = new AndFilter();
        filter.and(new EqualsFilter("objectclass", "person")).and(
                new EqualsFilter("sAMAccountName", userName));
        return ldapTemplate.authenticate(DistinguishedName.EMPTY_PATH, filter
                .toString(), password);
    }
Applicationcontext.xml

<bean id="contextSource"
        class="org.springframework.ldap.core.support.LdapContextSource">
        <property name="url" value="ldap://10.10.10.10:389" />
        <property name="base" value="DC=lab2,DC=ins" />
        <property name="userDn" value="CN=Ldap Bind,OU=Service Accounts,OU=TECH,DC=lab2,DC=ins" />
        <property name="password" value="secret" />
    </bean>
    <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
        <constructor-arg ref="contextSource" />
    </bean>
    <bean id="ldapContact"
        class="ldap.ContactLDAP ">
        <property name="ldapTemplate" ref="ldapTemplate" />
    </bean>

我在这里遗漏了什么?

通过设置
java.naming.referral=follow
尝试跟踪推荐

Resource r = new ClassPathResource("applicationContext.xml");
        BeanFactory factory = new XmlBeanFactory(r);
        ContactLDAP contact = (ContactLDAP) factory.getBean("ldapContact"); 

        System.out.println(contact.authenticate("username", "secret"));