Author: markt
Date: Fri Jun  1 18:42:17 2007
New Revision: 543693

URL: http://svn.apache.org/viewvc?view=rev&rev=543693
Log:
Port fix for 33774. Retry on ServiceUnavailableException

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java?view=diff&rev=543693&r1=543692&r2=543693
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java Fri Jun  
1 18:42:17 2007
@@ -35,6 +35,7 @@
 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;
@@ -826,6 +827,21 @@
                 principal = authenticate(context, username, credentials);
 
             } catch (CommunicationException 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);
+
+            } catch (ServiceUnavailableException e) {
 
                 // log the exception so we know it's there.
                 containerLog.warn(sm.getString("jndiRealm.exception"), e);

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?view=diff&rev=543693&r1=543692&r2=543693
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Fri Jun  1 18:42:17 2007
@@ -18,6 +18,11 @@
   <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>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to