From 0961b5d624ef09f75487dd424f4403ba2d8f0c78 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 30 Mar 2011 12:48:13 +0000 Subject: [PATCH] Correct fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50991 Stop resource after app has finished with them but before they are unbound git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1086935 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/core/StandardContext.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 97cbdc08d..231ad3b5a 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -5437,15 +5437,16 @@ public class StandardContext extends ContainerBase if (log.isDebugEnabled()) log.debug("Processing standard container shutdown"); - fireLifecycleEvent(Lifecycle.CONFIGURE_STOP_EVENT, null); - - // JNDI resources are unbound in CONFIGURE_STOP_EVENT so it is now - // safe to stop the resources which will trigger the close method if - // present + // JNDI resources are unbound in CONFIGURE_STOP_EVENT so stop + // naming resoucres before they are unbound since NamingResoucres + // does a JNDI lookup to retrieve the resource. This needs to be + // after the application has finished with the resource if (namingResources != null) { namingResources.stop(); } + fireLifecycleEvent(Lifecycle.CONFIGURE_STOP_EVENT, null); + // Stop the Valves in our pipeline (including the basic), if any if (pipeline instanceof Lifecycle) { ((Lifecycle) pipeline).stop(); -- 2.11.0