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

commit fc7fd5deb2f7ea83ef188bf21bbcd3961e1ee745
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Sep 17 14:43:05 2026 +0100

    Align load() error handling with server.start() error handling
---
 java/org/apache/catalina/startup/Catalina.java | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/startup/Catalina.java 
b/java/org/apache/catalina/startup/Catalina.java
index 7fa1be7ddf..1feded95d6 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -874,7 +874,21 @@ public class Catalina {
     public void start() {
 
         if (getServer() == null) {
-            load();
+            try {
+                load();
+            } catch (Throwable t) {
+                // Re-throw critical errors immediately. Otherwise, try and 
clean-up first.
+                ExceptionUtils.handleThrowable(t);
+                log.fatal(sm.getString("catalina.initError"), t);
+                if (getServer() != null) {
+                    try {
+                        getServer().destroy();
+                    } catch (LifecycleException e) {
+                        log.debug(sm.getString("catalina.destroyFail"), e);
+                    }
+                }
+                return;
+            }
         }
 
         if (getServer() == null) {


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

Reply via email to