我在尝试使用Windows Active Directory验证用户名和密码时收到此错误 ActiveDirectoryLdapAuthenticationProvider类。如果有人有任何想法请分享........
版本
3.2.0.RELEASE 4.0.1.RELEASE
14:40:35,786 ERROR [io.undertow.request] (default task-6) UT005023: Exception handling request to /eFin_iAnalytics/j_spring_security_check: java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.replaceEach(Lj ava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/String;
at org.springframework.ldap.core.DistinguishedName.un mangleCompositeName(DistinguishedName.java:250) [spring-ldap-core-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.ldap.core.DistinguishedName.pa rse(DistinguishedName.java:217) [spring-ldap-core-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.ldap.core.DistinguishedName.<i nit>(DistinguishedName.java:176) [spring-ldap-core-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.security.ldap.SpringSecurityLd apTemplate.searchForSingleEntryInternal(SpringSecu rityLdapTemplate.java:208) [spring-security-ldap-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.ldap.authentication.a d.ActiveDirectoryLdapAuthenticationProvider.search ForUser(ActiveDirectoryLdapAuthenticationProvider. java:285) [spring-security-ldap-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.ldap.authentication.a d.ActiveDirectoryLdapAuthenticationProvider.doAuth entication(ActiveDirectoryLdapAuthenticationProvid er.java:130) [spring-security-ldap-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.ldap.authentication.A bstractLdapAuthenticationProvider.authenticate(Abs tractLdapAuthenticationProvider.java:61) [spring-security-ldap-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.authentication.Provid erManager.authenticate(ProviderManager.java:156) [spring-security-core-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.authentication.Provid erManager.authenticate(ProviderManager.java:177) [spring-security-core-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.web.authentication.Us ernamePasswordAuthenticationFilter.attemptAuthenti cation(UsernamePasswordAuthenticationFilter.java:9 4) [spring-security-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.web.authentication.Ab stractAuthenticationProcessingFilter.doFilter(Abst ractAuthenticationProcessingFilter.java:211) [spring-security-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 342) [spring-security-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.web.context.request.a sync.WebAsyncManagerIntegrationFilter.doFilterInte rnal(WebAsyncManagerIntegrationFilter.java:50) [spring-security-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.web.filter.OncePerRequestFilte r.doFilter(OncePerRequestFilter.java:108) [spring-web-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 342) [spring-security-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.web.context.SecurityC ontextPersistenceFilter.doFilter(SecurityContextPe rsistenceFilter.java:87) [spring-security-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.web.FilterChainProxy$ VirtualFilterChain.doFilter(FilterChainProxy.java: 342) [spring-security-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.web.FilterChainProxy. doFilterInternal(FilterChainProxy.java:192) [spring-security-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.security.web.FilterChainProxy. doFilter(FilterChainProxy.java:160) [spring-security-web-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(DelegatingFilterProxy.java:344) [spring-web-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at org.springframework.web.filter.DelegatingFilterPro xy.doFilter(DelegatingFilterProxy.java:261) [spring-web-4.0.1.RELEASE.jar:4.0.1.RELEASE]
at io.undertow.servlet.core.ManagedFilter.doFilter(Ma nagedFilter.java:56) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterC hainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at com.adv.efin.ianalytics.webapp.filter.MDCFilter.do Filter(MDCFilter.java:77) [classes:]
at io.undertow.servlet.core.ManagedFilter.doFilter(Ma nagedFilter.java:56) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterC hainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.FilterHandler.handleR equest(FilterHandler.java:85) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.ServletSecur ityRoleHandler.handleRequest(ServletSecurityRoleHa ndler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletDispatchingHan dler.handleRequest(ServletDispatchingHandler.java: 36) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.extension.undertow.security.SecurityCo ntextAssociationHandler.handleRequest(SecurityCont extAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.SSLInformati onAssociationHandler.handleRequest(SSLInformationA ssociationHandler.java:113) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.security.handlers.AuthenticationCallHa ndler.handleRequest(AuthenticationCallHandler.java :52) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.security.handlers.AbstractConfidential ityHandler.handleRequest(AbstractConfidentialityHa ndler.java:45) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.ServletConfi dentialityConstraintHandler.handleRequest(ServletC onfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.CachedAuthen ticatedSessionHandler.handleRequest(CachedAuthenti catedSessionHandler.java:70) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.security.handlers.SecurityInitialHandl er.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.extension.undertow.security.jacc.JACCC ontextIdHandler.handleRequest(JACCContextIdHandler .java:61)
at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.handlers.PredicateHandler.handl eRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler .handleFirstRequest(ServletInitialHandler.java:240 ) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler .dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler .access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler $1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.Connectors.executeRootHandler(C onnectors.java:168) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpSe rverExchange.java:687) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker( Unknown Source) [rt.jar:1.7.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source) [rt.jar:1.7.0_11]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_11]
<http use-expressions="true">
<intercept-url pattern="/login" access="permitAll"/>
<intercept-url pattern="/**" access="hasRole('ROLE_USER')"/>
<form-login/>
</http>
<authentication-manager>
<authentication-provider ref="ldapActiveDirectoryAuthProvider"/>
</authentication-manager>
<beans:bean id="ldapActiveDirectoryAuthProvider"
class="org.springframework.security.ldap.authentic ation.ad.ActiveDirectoryLdapAuthenticationProvider ">
<beans:constructor-arg value="example.com"/>
<beans:constructor-arg value="ldap://192.XXX.XX.XXX:389/"/>
<beans:property name="useAuthenticationRequestCredentials" value="true" />
<beans:property name="convertSubErrorCodesToExceptions" value="true" />
</beans:bean>
答案 0 :(得分:1)
看起来在运行时获取的Apache commons-lang版本与编译时使用的版本不同。出现这种情况的原因有很多,但最常见的是:
您的服务器类路径中只有一个版本的commons-lang,但它是较旧的版本,不包含以下方法:
StringUtils.replaceEach
希望这有帮助。