JNDI lookup errors often only include part of the name being looked up.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 14 Jul 2009 21:52:14 +0000 (21:52 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 14 Jul 2009 21:52:14 +0000 (21:52 +0000)
Provide debug logging that includes the complete name and how it was requested.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@794082 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/naming/LocalStrings.properties
java/org/apache/naming/SelectorContext.java

index 440c4f8..8731375 100644 (file)
@@ -17,6 +17,8 @@ contextBindings.unknownContext=Unknown context name : {0}
 contextBindings.noContextBoundToThread=No naming context bound to this thread
 contextBindings.noContextBoundToCL=No naming context bound to this class loader
 selectorContext.noJavaUrl=This context must be accessed through a java: URL
+selectorContext.methodUsingName=Call to method ''{0}'' with a Name of ''{1}''
+selectorContext.methodUsingString=Call to method ''{0}'' with a String of ''{1}''
 namingContext.contextExpected=Name is not bound to a Context
 namingContext.failResolvingReference=Unexpected exception resolving reference
 namingContext.nameNotBound=Name {0} is not bound in this Context
index 263f0a1..a0ab04b 100644 (file)
@@ -59,6 +59,9 @@ public class SelectorContext implements Context {
     public static final String IC_PREFIX = "IC_";
 
 
+    private static org.apache.juli.logging.Log log =
+        org.apache.juli.logging.LogFactory.getLog(SelectorContext.class);
+
     // ----------------------------------------------------------- Constructors
 
 
@@ -119,6 +122,12 @@ public class SelectorContext implements Context {
      */
     public Object lookup(Name name)
         throws NamingException {
+        
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("selectorContext.methodUsingName", "lookup",
+                    name));
+        }
+
         // Strip the URL header
         // Find the appropriate NamingContext according to the current bindings
         // Execute the lookup on that context
@@ -135,6 +144,12 @@ public class SelectorContext implements Context {
      */
     public Object lookup(String name)
         throws NamingException {
+
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("selectorContext.methodUsingString", "lookup",
+                    name));
+        }
+
         // Strip the URL header
         // Find the appropriate NamingContext according to the current bindings
         // Execute the lookup on that context
@@ -293,6 +308,12 @@ public class SelectorContext implements Context {
      */
     public NamingEnumeration<NameClassPair> list(Name name)
         throws NamingException {
+        
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("selectorContext.methodUsingName", "list",
+                    name));
+        }
+
         return getBoundContext().list(parseName(name));
     }
 
@@ -308,6 +329,12 @@ public class SelectorContext implements Context {
      */
     public NamingEnumeration<NameClassPair> list(String name)
         throws NamingException {
+        
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("selectorContext.methodUsingString", "list",
+                    name));
+        }
+
         return getBoundContext().list(parseName(name));
     }
 
@@ -327,6 +354,12 @@ public class SelectorContext implements Context {
      */
     public NamingEnumeration<Binding> listBindings(Name name)
         throws NamingException {
+
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("selectorContext.methodUsingName",
+                    "listBindings", name));
+        }
+
         return getBoundContext().listBindings(parseName(name));
     }
 
@@ -342,6 +375,12 @@ public class SelectorContext implements Context {
      */
     public NamingEnumeration<Binding> listBindings(String name)
         throws NamingException {
+
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("selectorContext.methodUsingString",
+                    "listBindings", name));
+        }
+
         return getBoundContext().listBindings(parseName(name));
     }
 
@@ -439,6 +478,12 @@ public class SelectorContext implements Context {
      */
     public Object lookupLink(Name name)
         throws NamingException {
+
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("selectorContext.methodUsingName",
+                    "lookupLink", name));
+        }
+
         return getBoundContext().lookupLink(parseName(name));
     }
 
@@ -454,6 +499,12 @@ public class SelectorContext implements Context {
      */
     public Object lookupLink(String name)
         throws NamingException {
+
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("selectorContext.methodUsingString",
+                    "lookupLink", name));
+        }
+
         return getBoundContext().lookupLink(parseName(name));
     }