문제

My properties no longer work with spring.

The error I get is:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ldapActiveDirectoryAuthProvider' defined in class path resource [application-context-security.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'user-search-base' of bean class [org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider]: Bean property 'user-search-base' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at com.wm.Ldap.AuthenticationExample.main(AuthenticationExample.java:38)
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'user-search-base' of bean class [org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider]: Bean property 'user-search-base' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1064)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperI

mpl.java:924)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)
    ... 13 more

Here is my code:

<bean id="ldapActiveDirectoryAuthProvider" class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider">
        <constructor-arg value="someurl" /> 
        <constructor-arg value="ldaps://someurl" />
        <property name="user-search-base" value=""/>
        <property name="user-search-filter" value="(sAMAccountName={0})"/>
        <property name="group-search-base" value="ou=blahblah"/>
        <property name="group-search-filter" value="member={0}"/>
        <property name="role-prefix" value="ROLE_"/>
        <property name="user-details-class" value="person"/>

    </bean>
도움이 되었습니까?

해결책

"user-search-base" should contain somethig like

"OU=myou,dc=xx,dc=yy"

다른 팁

All the property names you've specified are invalid, property names cannot have dashes in them (since they map to setters).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top