2 Replies Latest reply on Dec 30, 2002 11:30 AM by hbaxmann

    Setting Up An External JNDI LDAP Context

    darryl_staflund

      Hi all,

      Well it took a lot of hard trying but I finally establishing a working external JNDI LDAP context on JBoss 3.0.4. The task was actually quite difficult because the free and for-pay documentation had misleading and incomplete instructions in it.

      Here is how I set it up:

      1. I defined an 'org.jboss.naming.ExternalContext' MBean in the 'jboss-service.xml' file. Unlike the 'JBoss Administration and Development (Second Edition), pp. 125-7' text which stated that the MBean should be defined as follows:

      <!-- Bind a remote LDAP server. -->

      external/ldap/jboss
      jboss.ldap
      javax.naming.ldap.InitialLdapContext
      true


      I found that I had to define the bean as follows:

      <!-- Bind a remote LDAP server -->

      external/ldap/openldap
      openldap.properties
      javax.naming.directory.InitialDirContext
      true
      true
      jboss:service=Naming


      Apart from some differences in values due to my local configuration needs, two things need to be pointed out:

      1. If you want to specify the LDAP properties in an external file, you cann't use the "Properties" attribute to specify its URL. THIS WILL NOT WORK. Instead, you have to use the "PropertiesURL" attribute. I didn't figure this out until I used the JMX Console to view the attributes of this MBean. It states that the "PropertiesURL" attribute accepts a URI of type "java.lang.String". It also states that the "Properties" attribute accepts a "java.util.Properties" object of key/value pairs. No wonder why I couldn't establish an LDAP connection using the commercial instructions :-)

      2. I also found that I needed to specify an MBean depency. If I didn't an incomplete deployment message would appear on the console.

      I hope this helps everyone.

      Ciao,
      Darryl Staflund

        • 1. Re: Setting Up An External JNDI LDAP Context
          darryl_staflund

          Hi again,

          One other thing I forgot to mention. I also found that in addition to the changes I mentioned in my previous posting, I also had to make two changes to the ldap.properties file in order to avoid authentication errors.

          The commercial documentation states that the URL and Principal properties have to be defined as follows:

          javax.naming.provider.url=ldap://:/o=jboss.org
          javax.naming.security.principal=cn=Directory Manager

          Specifying the information in this form caused nothing but authentication errors for me. In order to authenticate properly, I had to define the properties as follows:

          javax.naming.provider.url=ldap://:/
          javax.naming.security.principal=cn=Directory Manager,o=jboss.org

          I hope this also helps.

          Darryl

          • 2. Re: Setting Up An External JNDI LDAP Context
            hbaxmann

            hi all ldap's

            don't know if it is still an issue or if somebody get the hands dirty on this: do preferably not try to inspect a fairly large ldap context in the jndi view. you have to restart some things, afterwards.

            bax