SpringLDAP身份验证方法抛出java.lang.NoSuchMethodError
我试图使用SpringLDAP(1.3.1.RELEASE)中的SpringLDAP身份验证方法抛出java.lang.NoSuchMethodError,spring,spring-ldap,Spring,Spring Ldap,我试图使用SpringLDAP(1.3.1.RELEASE)中的LDAPTemplate authenticate方法,但它引发以下异常 java.lang.NoSuchMethodError:org.springframework.ldap.core.LdapTemplate.authenticate(Ljavax/naming/Name;Ljava/lang/String;Ljava/lang/String;)Z 以下是我的Maven 3.0.1依赖项 <dependency>
LDAPTemplate authenticate
方法,但它引发以下异常
java.lang.NoSuchMethodError:org.springframework.ldap.core.LdapTemplate.authenticate(Ljavax/naming/Name;Ljava/lang/String;Ljava/lang/String;)Z
以下是我的Maven 3.0.1依赖项
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core-tiger</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-odm</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-ldif-core</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-ldif-batch</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
仅供参考。。。我使用了其他
LDAPTemplate
方法,如search
,bind
,unbind
,没有任何问题。重新启动服务器后,错误消失了
可能是Maven(或IDE)缓存了旧版本的库,导致运行时版本比用于编译的版本旧
AndFilter andFilter = new AndFilter();
andFilter.and(new EqualsFilter("objectclass", "person"));
andFilter.and(new EqualsFilter("uid", "myid"));
ldapTemplate.authenticate(DistinguishedName.EMPTY_PATH, andFilter.toString(), "password");