java - 应用程序服务器启动时出现 Spring Security LDAP 配置 BeanCreationException

标签 java spring spring-security ldap

我正在尝试将 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>" />

感谢您提供的任何见解!

最佳答案

这看起来像是您包含的 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

关于java - 应用程序服务器启动时出现 Spring Security LDAP 配置 BeanCreationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11569812/

相关文章:

java - 定义返回列表的 REST 端点

java - CSRF 和 Spring Security

java - Android firebase onStart 和 onStop 解释

java - 如何从其他 bean 属性值设置 bean 属性值

java - 在单元测试期间回滚自动生成的表值

java - Spring 安全 : mapping of exceptions thrown inside security filter

jsp - 如何在jsp if标签中检查权限

java如何拆分混合语言字符串

java - Android - 还有一些与内存相关的问题

java - 使用 JPA 获取集合时避免 N+1 和笛卡尔积问题的标准方法是什么