This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 05559e2c65 Fix Stackoverflow reported in some Spring Boot 
configurations
05559e2c65 is described below

commit 05559e2c657deeb14ac763e41182d3ade37ae41f
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Sep 10 15:43:15 2026 +0100

    Fix Stackoverflow reported in some Spring Boot configurations
    
    https://github.com/spring-projects/spring-boot/issues/50651
---
 java/org/apache/catalina/core/StandardContext.java | 5 ++++-
 webapps/docs/changelog.xml                         | 5 +++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/core/StandardContext.java 
b/java/org/apache/catalina/core/StandardContext.java
index 4fce57e7ee..7c5dc96077 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -5149,7 +5149,10 @@ public class StandardContext extends ContainerBase 
implements Context, Notificat
         Loader loader = getLoader();
         ClassLoader webApplicationClassLoader = null;
         if (loader != null) {
-            webApplicationClassLoader = loader.getClassLoader();
+            // Don't bind the web application class loader if it isn't started 
yet.
+            if (!(loader instanceof Lifecycle) || ((Lifecycle) 
loader).getState().isAvailable()) {
+                webApplicationClassLoader = loader.getClassLoader();
+            }
         }
 
         Thread currentThread = Thread.currentThread();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 06201d0121..d567477601 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -241,6 +241,11 @@
         interface must implement this method. (markt)
       </fix>
       <!-- Entries for backport and removal before 12.0.0-M1 below this line 
-->
+      <fix>
+        When starting a web application, don't try and use the web application
+        class loader until after the web application class loader has started.
+        (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to