I’ve written a bit of code to access an LDAP server from my
JRuby/Rails app via a Glassfish external JNDI resource - I’ve been
using the pure-ruby gem ruby-net-ldap, but since I need to use SSL and
do more than one lookup in a request, that’s ended up pretty slow
(~0.5s per lookup).
The guts of the code is here:
It’s working pretty well: it’s fast, and the LDAP server configuration
gets to be in Glassfish rather than my app, but there’s one problem:
even though I believe I’m closing the resultset and context, the
underlying LDAP connection isn’t closed. Eventually the server kills
it off for being idle, but the context is still alive, and so all
requests fail from that point, until I either reconfigure the external
resource, or restart Glassfish.
I’m running with pooling disabled, as far as I can tell, but the
connection doesn’t get closed after each request.
I do want to use pooling if possible though. The failure ends up as a
CommunicationException, and I can catch that fine in this code, but I
can’t see how I can do a “close and reopen” on the context I get from
the JNDI lookup when that happens.
To unsubscribe from this list, please visit: