Author: markt
Date: Fri Jun  1 18:41:58 2007
New Revision: 543692

URL: http://svn.apache.org/viewvc?view=rev&rev=543692
Log:
Fix 33774. Retry on ServiceUnavailableException

Modified:
    
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JNDIRealm.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JNDIRealm.java
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JNDIRealm.java?view=diff&rev=543692&r1=543691&r2=543692
==============================================================================
--- 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JNDIRealm.java
 (original)
+++ 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JNDIRealm.java
 Fri Jun  1 18:41:58 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;
@@ -809,6 +810,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/container/tc5.5.x/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?view=diff&rev=543692&r1=543691&r2=543692
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Fri Jun  1 18:41:58 2007
@@ -28,6 +28,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>40593</bug> Cleanup that Listener stop after Manager stop 
         at StandardContext.stop(). Patch by Suzuki Yuichiro (pero)
       </fix>



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

Reply via email to