{"record":{"id":"c127611b3650857f","repo":"SonarSource/sonarqube","slug":"configuration-file-not-found-propsfile","errorCode":null,"errorMessage":"\"Configuration file not found: \" + propsFile","messagePattern":"\"Configuration file not found: \" \\+ propsFile","errorType":"console","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sonar-shutdowner/src/main/java/org/sonar/application/Shutdowner.java","lineNumber":80,"sourceCode":"    }\n  }\n\n  /**\n   * Loads the configuration file ${homeDir}/conf/sonar.properties.\n   * An empty {@link Properties} is returned if the file does not exist.\n   */\n  static Properties loadPropertiesFile(File homeDir) {\n    Properties p = new Properties();\n    File propsFile = new File(new File(homeDir, \"conf\"), \"sonar.properties\");\n    if (propsFile.exists()) {\n      try (Reader reader = new InputStreamReader(new FileInputStream(propsFile), UTF_8)) {\n        p.load(reader);\n        return p;\n      } catch (IOException e) {\n        throw new IllegalStateException(\"Cannot open file \" + propsFile, e);\n      }\n    } else {\n      throw new IllegalStateException(\"Configuration file not found: \" + propsFile);\n    }\n  }\n\n  static File resolveTempDir(Properties p) {\n    return new File(Optional.ofNullable(p.getProperty(\"sonar.path.temp\")).orElse(\"temp\"));\n  }\n\n  static void askForHardStop(File tmpDir) throws IOException {\n    writeToShareMemory(tmpDir, 1, (byte) 0xFF);\n  }\n\n  private static void writeToShareMemory(File tmpDir, int offset, byte value) throws IOException {\n    try (RandomAccessFile sharedMemory = new RandomAccessFile(new File(tmpDir, \"sharedmemory\"), \"rw\")) {\n      // Using values from org.sonar.process.ProcessCommands\n      MappedByteBuffer mappedByteBuffer = sharedMemory.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, 50L * 10);\n\n      // Now we are stopping all processes as quick as possible\n      // by asking for stop of \"app\" process","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/sonar-shutdowner/src/main/java/org/sonar/application/Shutdowner.java#L62-L98","documentation":"The Shutdowner (SonarQube server shutdown helper) loads a Java properties configuration file passed to loadPropertiesFile. When the file at the given path does not exist (Files.isRegularFile check fails), it throws IllegalStateException(\"Configuration file not found: \" + propsFile). This indicates the configured config path is wrong, the file was deleted, or the working directory differs from what was assumed.","triggerScenarios":"Calling loadPropertiesFile(path) where path does not point to an existing regular file; e.g. passing a relative path from the wrong working directory, a typo'd filename, or a path whose file was removed before startup.","commonSituations":"Wrong sonar home / working directory when launching the shutdowner; deployment scripts not copying conf files; running from an IDE where the working directory differs from the packaging layout; renamed or versioned config files (sonar.properties moved).","solutions":["Verify the file exists at the exact path passed in (ls <propsFile>) and fix the path.","If using a relative path, run the process from the expected directory or pass an absolute path.","Ensure deployment/packaging scripts actually place the properties file at that location.","Check for typos or environment-specific filenames (e.g. sonar.properties vs conf/sonar.properties)."],"exampleFix":"// before\nProperties p = Shutdowner.loadPropertiesFile(\"sonar.properties\");\n// after\nPath props = Paths.get(System.getenv(\"SONAR_HOME\"), \"conf\", \"sonar.properties\");\nif (!Files.isRegularFile(props)) {\n  throw new IllegalStateException(\"Check SONAR_HOME: expected config at \" + props);\n}\nProperties p = Shutdowner.loadPropertiesFile(props);","handlingStrategy":"validation","validationCode":"import java.nio.file.*;\nif (propsFile == null || !Files.isRegularFile(propsFile)) {\n  throw new IllegalArgumentException(\"Config file missing or not a regular file: \" + propsFile);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always resolve config paths from an absolute base directory (e.g. SONAR_HOME env var).","Check file existence at startup and fail fast with a clear message.","Log the absolute path (toAbsolutePath()) when loading config so mistakes are obvious."],"tags":["configuration","file-not-found","java"],"backgroundTag":"config-file-not-found","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}