You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Libor Arndt <li...@email.cz> on 2010/04/03 08:25:06 UTC

Ldap connection as resource problem

Hello,

I want to use LDAP as resource like I am used to access Oracle database to  
store user credentials.
I implemented custom factory class and defined a resource in the  
server.xml:

<Resource name="ldaptest"
auth="Container"
type="com.sun.jndi.ldap.LdapCtx"
factory="test.LdapFactory"
java.naming.factory.initial="com.sun.jndi.ldap.LdapCtxFactory"
com.sun.jndi.ldap.connect.pool="true"
java.naming.provider.url="ldap://....:389/"
java.naming.security.authentication="simple"
java.naming.security.principal="..."
java.naming.security.credentials="..."/>

Connection works but there are two fundamental problems:

A. During startup GlobalResourcesLifecycleListener is making a mBean for  
every entry in the LDAP directory. There are  tens of thousand of them.
The only way to prevent making mbeans is disabling the  
GlobalResourcesLifecycleListener in the server.xml, which is not possible  
in the production environment.
Is there any other way?
B. The Factory is called and InitialDirContext is created only once, then   
the binding type is changed from NamingEntry.REFERENCE to  
NamingEntry.ENTRY.
But having used it, I close the InitialDirContext and it's not reusable. I  
need to recreate InitialDirContext every time  it is looked up, not only  
the first time.
Is there any solution except for modyfing the Tomcat source?

thanks a lot in advance for any help.

Libor Arndt

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org