I have bit issue to find correct way to do this :)

Basically I have LDAP connection which I like to have like in session scope (as it's binded with user credentials), but as LDAP connection itself is not serializable so it's bit tricky to do :)
Currently I have EJB for service and there I'm getting LDAP connections (sessionscoped) via injecting. This is kind of working (as running on single node), but serialization errors kicking in when closing.

I had idea to use Singleton to keep managing connections, but I don't think even this works as again LDAP connection itself is not serializable in case Singleton and EJB are in different node.
So optimally when LDAP query kicks in, we can create connection if it's not there .. but it should be kept alive until http session closes :)

I'm trying to do something which is not possible or trying to make it too complicated way? :D