Spring LDAP返回异常:java.lang.ClassNotFoundException:org.springframework.ldap.core.LdapEncoder

时间:2014-03-12 17:37:57

标签: java spring spring-security spring-ldap

我正在使用Spring 3.2.7和Spring Security 3.2.0

我在本地Windows计算机上使用Apache DS 2.0.0。所有用户都将其密码存储为纯文本,不加密。

我在spring config XML中定义了以下内容:

        <?xml version="1.0" encoding="UTF-8"?> 
        <beans xmlns="http://www.springframework.org/schema/beans"  xmlns:security="http://www.springframework.org/schema/security" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xmlns:jdbc="http://www.springframework.org/schema/jdbc" 
        xmlns:context="http://www.springframework.org/schema/context"  
        xsi:schemaLocation="        
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd      
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd        
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd       
    http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd">         
    <security:http auto-config="true" >         
    <security:intercept-url pattern="/hello" access="ROLE_SCARVAREZ_MEMBER" />      
<security:form-login/>  
    </security:http>        
    <security:authentication-manager>
                            <security:ldap-authentication-provider 
                            user-dn-pattern="uid={0},ou=people"
                            group-search-base="ou=groups" 
                            group-search-filter="(member={0})"
                            >
                            </security:ldap-authentication-provider>        
    </security:authentication-manager>      
    <security:ldap-server url="ldap://localhost:10389/dc=example,dc=com" />      
    </beans>

我获得了默认的Spring登录表单。但是,当我尝试登录时,出现以下异常:

java.lang.ClassNotFoundException: org.springframework.ldap.core.LdapEncoder
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
    org.springframework.security.ldap.authentication.AbstractLdapAuthenticator.getUserDns(AbstractLdapAuthenticator.java:95)
    org.springframework.security.ldap.authentication.BindAuthenticator.authenticate(BindAuthenticator.java:80)
    org.springframework.security.ldap.authentication.LdapAuthenticationProvider.doAuthentication(LdapAuthenticationProvider.java:178)
    org.springframework.security.ldap.authentication.AbstractLdapAuthenticationProvider.authenticate(AbstractLdapAuthenticationProvider.java:61)
    org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
    org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:177)
    org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:94)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:211)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)

我无法弄清楚我需要包含哪些JAR文件才能超越此异常。

我没有使用Maven,但这是我项目中的JAR文件:

aopalliance.jar 
aspectj-1.7.2.jar 
aspectjweaver-1.7.2.jar
commons-logging-1.1.1.jar 
javax.servlet.jsp.jstl-1.2.1.jar
javax.servlet.jsp.jstl-api-1.2.1.jar 
log4j-1.2.17.jar
sl4j-api-1.7.5.jar 
spring-aop-3.2.7.jar 
spring-aspects-3.2.7.jar
spring-beans-3.2.7.jar 
spring-context-3.2.7.jar 
spring-core-3.2.7.jar
spring-expression-3.2.7.jar 
spring-jdbc-3.2.7.jar
spring-ldap-core-2.0.1.jar 
spring-ldapcore-tiger.2.0.1.jar
spring-security-config-3.2.0.jar 
spring-security-core.3.2.0.jar
spring-security-ldap-3.2.0.jar 
spring-security-taglibs-3.2.0.jar
spring-security-web-3.2.0.jar 
spring-tx-3.2.7.jar 
spring-web-3.2.7.jar
spring-webmvc-3.2.7.jar

非常感谢任何帮助!

0 个答案:

没有答案