From: markt Date: Tue, 14 Jul 2009 21:52:14 +0000 (+0000) Subject: JNDI lookup errors often only include part of the name being looked up. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a05c3677c9fb5743e8db6844d2073d98fb6e5fd4;p=tomcat7.0 JNDI lookup errors often only include part of the name being looked up. 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 --- diff --git a/java/org/apache/naming/LocalStrings.properties b/java/org/apache/naming/LocalStrings.properties index 440c4f82b..87313757c 100644 --- a/java/org/apache/naming/LocalStrings.properties +++ b/java/org/apache/naming/LocalStrings.properties @@ -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 diff --git a/java/org/apache/naming/SelectorContext.java b/java/org/apache/naming/SelectorContext.java index 263f0a1f4..a0ab04b79 100644 --- a/java/org/apache/naming/SelectorContext.java +++ b/java/org/apache/naming/SelectorContext.java @@ -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 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 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 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 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)); }