From: markt Date: Sat, 2 Jun 2007 01:42:17 +0000 (+0000) Subject: Port fix for 33774. Retry on ServiceUnavailableException X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=bf448eda7aae1a31bbb49286754c862363759f75;p=tomcat7.0 Port fix for 33774. Retry on ServiceUnavailableException git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@543693 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/realm/JNDIRealm.java b/java/org/apache/catalina/realm/JNDIRealm.java index e9ec25b2c..a46527733 100644 --- a/java/org/apache/catalina/realm/JNDIRealm.java +++ b/java/org/apache/catalina/realm/JNDIRealm.java @@ -35,6 +35,7 @@ import javax.naming.NamingException; 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; @@ -840,6 +841,21 @@ public class JNDIRealm extends RealmBase { // 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); + } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 24d1710c1..74fffdf84 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -18,6 +18,11 @@ + 33774 Retry JNDI authentiction on ServiceUnavailableException + as at least one provider throws this after an idle connection has been + closed. (markt) + + 39875: Fix BPE in RealmBase.init(). Port of yoavs's fix from Tomcat 5. (markt)