https://bz.apache.org/bugzilla/show_bug.cgi?id=62607

            Bug ID: 62607
           Summary: Catalina exits with status code 0 when the
                    configuration is invalid
           Product: Tomcat 9
           Version: 9.0.10
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: ebo...@apache.org
  Target Milestone: -----

With a malformed server.xml file, "catalina.sh confitest" reports the error and
exits with the status code 1. But with "catalina.sh run" the status code is 0
(SUCCESS). This confuses daemon management systems like systemd which might not
report the error properly, or attempt to restart the server repeatedly.

Here is a suggested fix:

--- a/java/org/apache/catalina/startup/Bootstrap.java
+++ b/java/org/apache/catalina/startup/Bootstrap.java
@@ -489,6 +489,10 @@
             } else if (command.equals("start")) {
                 daemon.setAwait(true);
                 daemon.load(args);
+                if (null == daemon.getServer()) {
+                    log.fatal("Cannot start server. Server instance is not
configured.");
+                    System.exit(1);
+                }
                 daemon.start();
             } else if (command.equals("stop")) {
                 daemon.stopServer(args);

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to