Results 1 to 5 of 5

Thread: Multiple LDAP Urls

  1. #1
    Join Date
    Sep 2006
    Posts
    3

    Default Multiple LDAP Urls

    Hi, I have successfully got things working with one of my servers. Now I'm trying to hit multiple ldap servers and having no luck.

    Here is my spring context:

    Code:
       <!-- Define the ldap context source -->
        <bean id="contextSource" class="org.springframework.ldap.support.LdapContextSource">
            <property name="urls" value="ldap://10.71.200.11:389, ldap://10.91.200.11:389"/>
            <property name="authenticationSource" ref="authenticationSource"/>
        </bean>
    
        <!-- Define our authentication source -->
        <bean id="authenticationSource"
              class="org.springframework.ldap.support.authentication.DefaultValuesAuthenticationSourceDecorator">
            <property name="target" ref="threadLocalAuthenticationSource"/>
            <property name="defaultUser" value="manager"/>
            <property name="defaultPassword" value="secret"/>
        </bean>
    
        <bean id="threadLocalAuthenticationSource" class="com.edlending.spring.ThreadLocalAuthenticationSource"/>
    
        <!-- Define the LdapTemplate -->
        <bean id="ldapOperations" class="org.springframework.ldap.LdapTemplate">
            <constructor-arg ref="contextSource"/>
            <property name="ignorePartialResultException" value="true"/>
        </bean>
    Am I doing something wrong with my urls property of the contextSource?

    Thanks in advance.

  2. #2
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    The configuration looks ok to me. What happens (i.e. are you getting a stack trace or is there something else going wrong)?
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  3. #3
    Join Date
    Sep 2006
    Posts
    3

    Default

    No stack trace, just not getting the results I expect.

    For example, if I do a search for a person based on a unique attribute when I only have 1 url specified the result is as expected. However when I add the 2nd URL the first search no longer works.

    I apologize as I have not looked into implementation details, but I expected that the search would search both LDAP trees in this case.

    Thanks,
    Bryan

  4. #4
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    I'm afraid that's not the way it works. The use of multiple urls is described in Sun's ldap tutorial:
    Instead of just one URL, you can also supply a space-separated list of URLs. In this case, the LDAP provider will attempt to use each URL in turn until it is able to create a successful connection. The LDAP provider will then set the Context.PROVIDER_URL property to the successful URL, so that the application can determine which URL is being used.
    It's mostly useful for ensuring access to an LDAP server when you have a number of mirrored servers and don't care which one you connect to.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  5. #5
    Join Date
    Sep 2006
    Posts
    3

    Default

    Gotcha thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •