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

rmaucher pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new fa2bc6a16b Undeploy missing context
fa2bc6a16b is described below

commit fa2bc6a16b0e1ad33d8f99f1f010c5a6656291ca
Author: remm <[email protected]>
AuthorDate: Wed Sep 2 20:44:46 2026 +0200

    Undeploy missing context
    
    Not sure it can really happen, but the code already handles some
    unlikely similar cases.
---
 java/org/apache/catalina/startup/HostConfig.java | 8 +++++++-
 java/org/apache/catalina/startup/UserConfig.java | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/startup/HostConfig.java 
b/java/org/apache/catalina/startup/HostConfig.java
index 5b9cca9546..9bf96b41b0 100644
--- a/java/org/apache/catalina/startup/HostConfig.java
+++ b/java/org/apache/catalina/startup/HostConfig.java
@@ -1340,7 +1340,13 @@ public class HostConfig implements LifecycleListener {
                         // The only resource that should be deleted is the
                         // expanded WAR (if any)
                         Context context = (Context) host.findChild(app.name);
-                        String docBase = context.getDocBase();
+                        String docBase = context == null ? null : 
context.getDocBase();
+                        if (context == null || docBase == null) {
+                            // Context missing or broken - redeploy instead of 
reload
+                            undeploy(app);
+                            deleteRedeployResources(app, resources, i, false);
+                            return;
+                        }
                         if 
(!docBase.toLowerCase(Locale.ENGLISH).endsWith(".war")) {
                             // This is an expanded directory
                             File docBaseFile = new File(docBase);
diff --git a/java/org/apache/catalina/startup/UserConfig.java 
b/java/org/apache/catalina/startup/UserConfig.java
index b9f86b2d43..465d95bbe9 100644
--- a/java/org/apache/catalina/startup/UserConfig.java
+++ b/java/org/apache/catalina/startup/UserConfig.java
@@ -363,6 +363,7 @@ public final class UserConfig implements LifecycleListener {
         try {
             Class<?> clazz = Class.forName(contextClass);
             Context context = (Context) clazz.getConstructor().newInstance();
+            // StandardContext or any compatible Context impl should also set 
the name derived from the path
             context.setPath(contextPath);
             context.setDocBase(app.toString());
             clazz = Class.forName(configClass);


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

Reply via email to