Announcement Announcement Module
No announcement yet.
Multiple LDAP Urls Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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:

       <!-- Define the ldap context source -->
        <bean id="contextSource" class="">
            <property name="urls" value="ldap://, ldap://"/>
            <property name="authenticationSource" ref="authenticationSource"/>
        <!-- Define our authentication source -->
        <bean id="authenticationSource"
            <property name="target" ref="threadLocalAuthenticationSource"/>
            <property name="defaultUser" value="manager"/>
            <property name="defaultPassword" value="secret"/>
        <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"/>
    Am I doing something wrong with my urls property of the contextSource?

    Thanks in advance.

  • #2
    The configuration looks ok to me. What happens (i.e. are you getting a stack trace or is there something else going wrong)?


    • #3
      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.



      • #4
        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.


        • #5
          Gotcha thanks.