Announcement Announcement Module
Collapse
No announcement yet.
constructor issues for LdapAuthenticationProvider. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • constructor issues for LdapAuthenticationProvider.

    I'm trying various ways to integrate acegi security with spring-ws.
    I've managed to use plain text and hashed password with memory and dao.

    Now I'm trying to work on Ldap. Since LdapAuthenticationProvider is a provider (rather than a userDetailsService) I'm only trying to get it work with plain text passwords.

    I declare ldapAuthProvider in my applicationContext.xml as follows:
    Code:
    <bean id="ldapAuthProvider" class="org.acegisecurity.providers.ldap.LdapAuthenticationProvider" >
    <constructor-arg index="0">
    	<bean class="org.acegisecurity.providers.ldap.authenticator.BindAuthenticator">
    	<constructor-arg><ref local="initialDirContextFactory" />
                 </constructor-arg>
      	<property name="userSearch" ref="userSearch" /> 
      	</bean>
      	</constructor-arg>
    	<constructor-arg index="1">
    	<bean class="org.acegisecurity.providers.ldap.populator.DefaultLdapAuthoritiesPopulator">
                  <constructor-arg>
                  <ref local="initialDirContextFactory" />
                  </constructor-arg>
    							<constructor-arg>
                 <value>CN=Groups,DC=utdtest,DC=com</value>
                 </constructor-arg>
    	<property name="groupRoleAttribute">
                 <value>cn</value></property>
                  </bean>
    	</constructor-arg>
    </bean>
    which has 2 constructor arguments, and the constuctor from the java looks like this:
    Code:
            public LdapAuthenticationProvider(LdapAuthenticator authenticator,
                  LdapAuthoritiesPopulator authoritiesPopulator) {
            this.setAuthenticator(authenticator);
            this.setAuthoritiesPopulator(authoritiesPopulator);
        }
    So it seems that bean instantiation should work, however I get the error:
    ...
    Caused by:
    org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.acegisecurity.providers.ldap.LdapAuthenticatio nProvider]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.acegisecurity.providers.ldap.LdapAuthenticatio nProvider.<init>()
    Caused by:
    java.lang.NoSuchMethodException: org.acegisecurity.providers.ldap.LdapAuthenticatio nProvider.<init>()
    at java.lang.Class.getConstructor0(Class.java:2647)
    at java.lang.Class.getDeclaredConstructor(Class.java: 1953)
    at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:148)
    ...

    any idea why? I'm not sure if this is an acegi issue, spring-ws, or something I'm doing wrong - any advice?

    I'm posting this to both the acegi and spring-ws forums.
    Thanks for any help.

  • #2
    sorry for the post

    My problem was I had another bean declared with no arguments (even though I wasn't using it for anything, of course spring was trying to create it).
    Sorry for the post.

    Comment

    Working...
    X