tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Gerdes <>
Subject JDNI Resource not reusable
Date Wed, 12 Dec 2007 15:32:16 GMT
Hash: SHA1


in my context.xml/server.xml I setup a JDNI resource which I access via:

Context newCtx = new InitialContext();
Context envCtx = (Context) newCtx.lookup("java:comp/env");
DirContext ctx = (DirContext) envCtx.lookup("ldap/ox");

I use this context and then I close it via ctx.close().

The next time I want to access my LDAP I do a lookup again the
DirContext object is the same (i.e., so it is one out of a
pool I guess). But the context cannot be used.

But when I do _not_ close() the context, I can use it several times,
until i am inactive for about 5 minutes. Then it seems it get closed
automatically and is not reusable anymore.

(Using com.sun.jndi.ldap.connect.pool="true" did not work and "true" did
not work either.)

If I hardcode my connection settings in my java class, everything works
fine. Every time I use the LDAP I do setup a new environment and I get a
new connection.

My problem only occurs when I use the resource via lookup from tomcat.

Anybody knows why? Atleast how do reuse the context or disable the pooling?

Thank you for an answer in advance

Kind regards,
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message