org.apache.james.user.ldap.ReadOnlyUsersLDAPRepository obtains its connection to the LDAP repository during init() processing and thereafter assumes it to be valid. When, as may sometimes temporarily or permanently occur, the connection becomes invalid the resulting javax.naming.CommunicationException is propogated to the caller and no attempt is made to reestablish the connection. James must be restarted to reestablish the connection, which is likely to be unacceptable in a production environment.
To correct this, org.apache.james.user.ldap.ReadOnlyUsersLDAPRepository needs to be modified in the following ways:
1) Make the connection timeout period configurable
2) Introduce the ability to attempt to reinstate and retry connections a configurable number of times with a configurable delay between retries when a recoverable exception is thrown