{"record":{"id":"5e19e3d75666ce19","repo":"apache/hadoop","slug":"journal-dir-should-be-an-absolute-path","errorCode":null,"errorMessage":"Journal dir '{}' should be an absolute path","messagePattern":"Journal dir '(.+?)' should be an absolute path","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java","lineNumber":203,"sourceCode":"      if (journalNodeDir == null) {\n        journalNodeDir = conf.get(DFSConfigKeys.DFS_JOURNALNODE_EDITS_DIR_KEY,\n            DFSConfigKeys.DFS_JOURNALNODE_EDITS_DIR_DEFAULT);\n      }\n      localDir.add(new File(journalNodeDir.trim()));\n    }\n\n    if (this.tracer == null) {\n      this.tracer = new Tracer.Builder(\"JournalNode\").\n          conf(TraceUtils.wrapHadoopConf(\"journalnode.htrace\", conf)).\n          build();\n    }\n  }\n\n  private static void validateAndCreateJournalDir(File dir)\n      throws IOException {\n\n    if (!dir.isAbsolute()) {\n      throw new IllegalArgumentException(\n          \"Journal dir '\" + dir + \"' should be an absolute path\");\n    }\n    DiskChecker.checkDir(dir);\n  }\n\n  @Override\n  public Configuration getConf() {\n    return conf;\n  }\n\n  @Override\n  public int run(String[] args) throws Exception {\n    start();\n    return join();\n  }\n\n  /**\n   * Start listening for edits via RPC.","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java#L185-L221","documentation":"JournalNode.validateAndCreateJournalDir throws IllegalArgumentException at startup when any directory in dfs.journalnode.edits.dir is not absolute (File.isAbsolute() is false). Edit directories are used to build storage layout paths and are persisted in VERSION files, so relative paths that depend on the process CWD are rejected outright. This is a configuration sanity check that fails fast during JournalNode (or a tool using it) initialization.","triggerScenarios":"JournalNode starts with dfs.journalnode.edits.dir containing an entry like 'journaldata' or '~/journal' (the '~' is not expanded by Java), so dir.isAbsolute() is false. Each configured dir passes through validateAndCreateJournalDir before use.","commonSituations":"Using '~' or a relative directory in hdfs-site.xml (Java does not expand shell syntax); config generated from templates with an empty $VAR base path producing ' /jndir' or a bare suffix; running the JournalNode from a different working directory than in dev and only then noticing the relative path; systemd unit with non-obvious CWD.","solutions":["Edit hdfs-site.xml and give every dfs.journalnode.edits.dir entry a fully qualified absolute path (e.g., file:///data/journaldata or /data/journaldata).","Replace '~' with the literal home directory or an env-var-expanded absolute path in your config management (Ansible/Chef templates are the usual culprit).","Re-run the JournalNode and confirm it passes storage dir validation and starts the RPC server.","If multiple dirs are configured, fix all of them — validation iterates each and fails on the first relative one."],"exampleFix":"<!-- before -->\n<property>\n  <name>dfs.journalnode.edits.dir</name>\n  <value>journaldata</value>\n</property>\n<!-- IllegalArgumentException: Journal dir 'journaldata' should be an absolute path -->\n\n<!-- after -->\n<property>\n  <name>dfs.journalnode.edits.dir</name>\n  <value>/data/journaldata</value>\n</property>","handlingStrategy":"validation","validationCode":"for (URI u : JournalNode.getJournalDirList(conf)) {\n  File dir = new File(u.getPath());\n  if (!dir.isAbsolute()) {\n    throw new IllegalArgumentException(\"Fix config: \" + u + \" must be absolute\");\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write dfs.journalnode.edits.dir entries as absolute paths (no '~', no relative segments).","Validate configuration in CI (a lint pass over hdfs-site.xml) before deploying.","Expand env vars in config templates at render time, not at runtime."],"tags":["hdfs","qjournal","configuration","path","startup"],"backgroundTag":"invalid-config-path","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}