Announcement Announcement Module
Collapse
No announcement yet.
Using LdapTemplate with JNDI Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using LdapTemplate with JNDI

    Hi,
    is it possible to configure the LdapContextSource of the LdapTemplate for a JNDI lookup? That is, I have the following specified in my context:

    Code:
    <bean id="ldapTemplate" class="org.springframework.ldap.LdapTemplate">
    	<constructor-arg>
    		<bean class="org.springframework.ldap.support.LdapContextSource">
    		<property name="url" value="${ldap.url}" />
    		<property name="base" value="${ldap.base}" />
    		<property name="userName" value="${ldap.username}" />
    		<property name="password" value="${ldap.password}" />
    		<property name="baseEnvironmentProperties">
    			<map>
    				<entry key="java.naming.referral" value="follow" />
    			</map>
    		</property>
    	</bean>
    	</constructor-arg>
    </bean>
    The $ properties are stored in a properties file. I want to be able to just specify the JNDI name and let WebSphere manage the underlying connection parameters above, like jdbc data sources. Can the template be wrapped in a JndiObjectFactoryBean?
    Thanks
    Alan

  • #2
    I would not store the LdapTemplate instance in JNDI, but rather the ContextSource instance, just as you would do with a DataSource. Then it would be trivial to tell ldapTemplate to use a ContextSource which is retrieved from a JndiObjectFactoryBean.

    Comment


    • #3
      Originally posted by ulsa View Post
      I would not store the LdapTemplate instance in JNDI, but rather the ContextSource instance, just as you would do with a DataSource. Then it would be trivial to tell ldapTemplate to use a ContextSource which is retrieved from a JndiObjectFactoryBean.
      Thanks - I did mean the ContextSource as you say. Configuring a data source for jdbc access is easy in WebSphere 6 but I am not sure how to set up an LDAP connection as a JNDI instance. Anyway, I will try this today.
      Thanks again
      Alan

      Comment


      • #4
        Did you end up finding a solution to this? We also have jdbc data sources setup in WebSphere (6.1), and access them in the spring context via jndi lookups. However, I cannot seem to figure out how to do the same sort of thing with an LDAP ContextSource.

        Thank you.

        Comment


        • #5
          thanks for this information, it is too important.

          Comment


          • #6
            Hi, can anyone post the solution if you have? Can we create the Jndi for Ldap ContextSource?
            I do find some posts talking about it, but no solution finally.

            Comment


            • #7
              I too am looking for this but can't find an example. There are examples that get ldap conn details from jndi but not the ContextSource......

              Comment

              Working...
              X