【问题标题】:Spring Security LDAP Configuration BeanCreationException on app server startup应用服务器启动时的 Spring Security LDAP 配置 BeanCreationException
【发布时间】:2012-07-19 04:00:49
【问题描述】:

我正在尝试将我的 Spring 3.1 应用程序连接到我的内部 Zimbra LDAP 服务器。我正在做一些可能非常愚蠢的事情,我看不到问题所在。我确定我定义的组和用户群以及过滤器术语可能存在问题,但这不应该在应用服务器启动时导致 BeanCreationException,不是吗?我可以用另一双眼睛...

异常的简短版本:

“无法将 LdapAuthenticationProvider 转换为属性提供者所需的类型 AuthenticationProvider[0]”

完整的例外:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot create inner bean '(inner bean)' of type [org.springframework.security.config.authentication.AuthenticationManagerFactoryBean] while setting bean property 'parent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#16': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.util.List' for property 'providers'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.security.ldap.authentication.LdapAuthenticationProvider] to required type [org.springframework.security.authentication.AuthenticationProvider] for property 'providers[0]': no matching editors or conversion strategy found

相关的Spring配置文件入口:

<security:authentication-manager>
    <security:ldap-authentication-provider
        group-search-filter="member={0}"
        group-search-base="ou=groups"
        user-search-base="ou=people"
        user-search-filter="uid={0}"
    />        
</security:authentication-manager>

<security:ldap-server url="ldap://<correct IP and port>" manager-dn="uid=zimbra,cn=admins,cn=zimbra" manager-password="<private>" />

感谢您提供的任何见解!

【问题讨论】:

  • 它可能与异常无关,但是参数分配user-search-base="ou=people"可能缺少DN的最右边部分,除非您的命名上下文实际上是"ou=people"

标签: java spring spring-security ldap


【解决方案1】:

这看起来像是您包含的 Spring 库之间的不匹配。 您需要确保您的 Spring Security LDAP 库与您的其他 Spring Security 库版本匹配。

例如:

spring-security-web-3.1.0.RELEASE.jar
spring-security-core-3.1.0.RELEASE.jar
spring-security-config-3.1.0.RELEASE.jar
spring-security-ldap-3.1.0.RELEASE.jar

【讨论】:

    猜你喜欢
    • 2016-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-30
    • 2017-02-13
    • 2019-12-31
    • 2016-04-13
    • 2018-10-05
    相关资源
    最近更新 更多