This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 5fc9e260a1 Undeploy missing context
new 97121926fc Merge branch '10.1.x' of [email protected]:apache/tomcat.git
into 10.1.x
5fc9e260a1 is described below
commit 5fc9e260a152dd3f2bad7adf7c47d7e703a5b738
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 8de0822f49..b45bfea3b9 100644
--- a/java/org/apache/catalina/startup/HostConfig.java
+++ b/java/org/apache/catalina/startup/HostConfig.java
@@ -1380,7 +1380,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 de8618395f..326a32f97d 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]