我正在尝试使用LDAPTemplate authenticate
Spring LDAP (1.3.1.RELEASE) 中的方法,但它会引发以下异常
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>
以下是我用来验证的代码
AndFilter andFilter = new AndFilter();
andFilter.and(new EqualsFilter("objectclass", "person"));
andFilter.and(new EqualsFilter("uid", "myid"));
ldapTemplate.authenticate(DistinguishedName.EMPTY_PATH, andFilter.toString(), "password");
仅供参考...我使用了其他LDAPTemplate
方法,例如search
, bind
,unbind
没有任何问题。