{"record":{"id":"adf0410c2953205c","repo":"apache/hadoop","slug":"system-property-log4j-configuration-not-defined","errorCode":null,"errorMessage":"System property 'log4j.configuration' not defined","messagePattern":"System property 'log4j\\.configuration' not defined","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSConfiguration.java","lineNumber":177,"sourceCode":"      newer = f.lastModified() - time > 100;\n    }\n    return newer;\n  }\n\n  /**\n   * Validate whether \"kms.config.dir\" and \"log4j.configuration\" are defined in the System\n   * properties. If not, abort the KMS WebServer.\n   */\n  public static void validateSystemProps() {\n    if (System.getProperty(KMS_CONFIG_DIR) == null) {\n      String errorMsg = \"System property '\" + KMS_CONFIG_DIR + \"' not defined\";\n      System.err.println(\"Aborting KMSWebServer because \" + errorMsg);\n      throw new RuntimeException(errorMsg);\n    }\n    if (System.getProperty(\"log4j.configuration\") == null) {\n      String errorMsg = \"System property 'log4j.configuration' not defined\";\n      System.err.println(\"Aborting KMSWebServer because \" + errorMsg);\n      throw new RuntimeException(errorMsg);\n    }\n  }\n}\n","sourceCodeStart":159,"sourceCodeEnd":181,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-kms/src/main/java/org/apache/hadoop/crypto/key/kms/server/KMSConfiguration.java#L159-L181","documentation":"The second half of KMSConfiguration.validateSystemProps (KMSConfiguration.java:177): if the JVM system property log4j.configuration is unset, KMS prints 'Aborting KMSWebServer because System property log4j.configuration not defined' and throws RuntimeException. KMS requires an explicit log4j config so logging is deterministic under its embedded server; the stock scripts point it at the kms.log4j.properties in the config dir.","triggerScenarios":"Launching the KMS without the wrapper scripts so -Dlog4j.configuration=... is never passed; or a launcher that only sets kms.config.dir but not the log4j property. Both properties are mandatory for KMSWebServer to boot.","commonSituations":"Custom systemd/Docker launches; upgrading scripts that drop the log4j flag; switching to log4j2-only environments where the legacy property is considered obsolete but this KMS version still demands it.","solutions":["Start KMS with the stock kms.sh / hadoop-kms scripts, which set -Dlog4j.configuration=<confdir>/kms.log4j.properties","When launching manually, pass both -Dkms.config.dir=/etc/hadoop-kms/conf and -Dlog4j.configuration=/etc/hadoop-kms/conf/kms.log4j.properties","Confirm the referenced log4j properties file exists at that path"],"exampleFix":"# before\njava -Dkms.config.dir=/etc/hadoop-kms/conf -jar kms.war\n# after\njava -Dkms.config.dir=/etc/hadoop-kms/conf \\\n  -Dlog4j.configuration=/etc/hadoop-kms/conf/kms.log4j.properties \\\n  -jar kms.war","handlingStrategy":"validation","validationCode":"if (System.getProperty(\"log4j.configuration\") == null)\n  System.setProperty(\"log4j.configuration\", confDir + \"/kms.log4j.properties\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set -Dlog4j.configuration=<confdir>/kms.log4j.properties in every launcher","Verify the log4j properties file exists at that path before start","Keep custom launchers in sync with the flags kms.sh sets"],"tags":["hadoop-kms","configuration","log4j","startup-failure","missing-system-property"],"backgroundTag":"missing-system-property","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}