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);
Fixed in: - trunk for 9.0.11 onwards - 8.5.x for 8.5.33 onwards - 7.0.x for 7.0.91 onwards
Thank you Mark, I could have committed it though ;)