import javax.naming.NameParser;
import javax.naming.Name;
import javax.naming.AuthenticationException;
+import javax.naming.ServiceUnavailableException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
// Try the authentication again.
principal = authenticate(context, username, credentials);
+ } catch (ServiceUnavailableException e) {
+
+ // log the exception so we know it's there.
+ containerLog.warn(sm.getString("jndiRealm.exception"), e);
+
+ // close the connection so we know it will be reopened.
+ if (context != null)
+ close(context);
+
+ // open a new directory context.
+ context = open();
+
+ // Try the authentication again.
+ principal = authenticate(context, username, credentials);
+
}
<subsection name="Catalina">
<changelog>
<fix>
+ <bug>33774</bug> Retry JNDI authentiction on ServiceUnavailableException
+ as at least one provider throws this after an idle connection has been
+ closed. (markt)
+ </fix>
+ <fix>
<bug>39875</bug>: Fix BPE in RealmBase.init(). Port of yoavs's fix from
Tomcat 5. (markt)
</fix>