Spring Security LDAP Configuration在应用服务器启动时发生BeanCreationException
问题描述:
我试图将我的Spring 3.1应用程序连接到我的内部Zimbra LDAP服务器。我正在做一些可能非常愚蠢的事情,我看不出问题所在。我确定可能存在与我定义的组和用户群和过滤条件有关的问题,但是应该不会在应用服务器启动时导致BeanCreationException,应该如何?我可以用另一双眼睛......Spring Security LDAP Configuration在应用服务器启动时发生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
它可能什么都没有做的异常,但参数赋值'用户的搜索基=“OU =人”'可能丢失的最右边的部分DN,除非你的命名上下文实际上是“ou = people”。 – 2012-07-20 12:00:47