0 Replies Latest reply on Nov 25, 2004 5:18 AM by Anders Odeskog

    Searching LDAP White Pages through JNDI

    Anders Odeskog Newbie

      We are building an application to facilitate seaches of our LDAP White pages catalog (through jndi). The structure we use is with a DAO and stateless session beans.
      The DAO creates a connection to the LDAP server with "new InitialDirContext(...)" and then a normal search operation is done. Many times we use multi-level searches and this generates lots and lots of InitialDirContexts and connections. The result is that our LDAP-server (iPlanet) is overwhelmed.

      Now, the normal way to use jndi is to create new contexts from the initial one with the lookup()-method. However, the stateless session bean makes this impossible because we can't keep a reference to the initial dir context.

      What I would like to know is, what method should we use to keep this reference?
      The context mustn't be shared between sessions, and preferrably the connection shouldn't be kept open for too long either. My idea is that we could keep this reference during a page load (HTTP request) and then throw it away.

      Any suggestions?