{"record":{"id":"eddd40250fb9016d","repo":"SonarSource/sonarqube","slug":"fail-to-launch-process-s","errorCode":null,"errorMessage":"Fail to launch process [%s]","messagePattern":"Fail to launch process \\[(.+?)\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"server/sonar-main/src/main/java/org/sonar/application/ProcessLauncherImpl.java","lineNumber":231,"sourceCode":"    }\n  }\n\n  private static void storeElasticsearchLog4j2Properties(EsInstallation esInstallation) {\n    try (FileOutputStream fileOutputStream = new FileOutputStream(esInstallation.getLog4j2PropertiesLocation())) {\n      esInstallation.getLog4j2Properties().store(fileOutputStream, \"log4j2 properties file for ES bundled in SonarQube\");\n    } catch (IOException e) {\n      throw new IllegalStateException(\"Failed to write ES configuration files\", e);\n    }\n  }\n\n  private <T extends JvmOptions> Process launchJava(JavaCommand<T> javaCommand) {\n    ProcessId processId = javaCommand.getProcessId();\n    try {\n      ProcessBuilder processBuilder = create(javaCommand);\n      logLaunchedCommand(javaCommand, processBuilder);\n      return processBuilder.start();\n    } catch (Exception e) {\n      throw new IllegalStateException(format(\"Fail to launch process [%s]\", processId.getHumanReadableName()), e);\n    }\n  }\n\n  private static <T extends AbstractCommand> void logLaunchedCommand(AbstractCommand<T> command, ProcessBuilder processBuilder) {\n    LOG.atInfo()\n      .addArgument(command::getProcessId)\n      .addArgument(() -> command.getWorkDir().getAbsolutePath())\n      .addArgument(() -> String.join(\" \", processBuilder.command()))\n      .log(\"Launch process[{}] from [{}]: {}\");\n  }\n\n  private <T extends JvmOptions> ProcessBuilder create(JavaCommand<T> javaCommand) {\n    List<String> commands = new ArrayList<>();\n    commands.add(buildJavaPath());\n    commands.addAll(javaCommand.getJvmOptions().getAll());\n    commands.addAll(buildClasspath(javaCommand));\n    commands.add(javaCommand.getClassName());\n    commands.addAll(javaCommand.getParameters());","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-main/src/main/java/org/sonar/application/ProcessLauncherImpl.java#L213-L249","documentation":"launchJava builds a ProcessBuilder from the given JavaCommand and starts the child JVM (web, CE, or Elasticsearch). Any exception during command creation or process start (missing java binary, invalid JVM options, OS exec failure) is wrapped in this IllegalStateException naming the process.","triggerScenarios":"launch() -> launchJava() where create(javaCommand) or processBuilder.start() throws — typically the java executable cannot be found/executed, or an invalid JVM option/command line is assembled.","commonSituations":"JAVA_HOME pointing to a missing or non-executable JDK; a Java version incompatible with SonarQube; malformed memory settings (e.g. bad -Xmx values from sonar.web.javaOpts) causing immediate exec failure; PATH issues when running under a service manager.","solutions":["Inspect the 'Caused by' in logs/sonar.log for the root cause of the exec failure.","Verify java (matching the required version) is on PATH or set JAVA_HOME correctly for the service user.","Check sonar.web.javaOpts / sonar.ce.javaOpts / sonar.search.javaOpts for invalid arguments.","Confirm the sonarqube user has execute permission on the JVM binary."],"exampleFix":"// before\nJAVA_HOME=/usr/lib/jvm/jdk-8  # unsupported/missing\n// after\nJAVA_HOME=/usr/lib/jvm/jdk-17  # supported JDK, on PATH for service user","handlingStrategy":"validation","validationCode":"String javaHome = System.getenv(\"JAVA_HOME\");\nPath java = (javaHome != null ? Paths.get(javaHome, \"bin\", \"java\") : Paths.get(\"java\"));\nif (!Files.isExecutable(java)) {\n    throw new IllegalStateException(\"Java executable not found/executable: \" + java);\n}","typeGuard":null,"tryCatchPattern":"try { launcher.launch(command, false); } catch (IllegalStateException e) { log.severe(\"Process launch failed: \" + e.getMessage() + \", cause=\" + e.getCause()); }","preventionTips":["Install a supported JDK version and point JAVA_HOME at it for the service user.","Validate sonar.*.javaOpts values before deployment.","Run SonarQube as a user with execute rights on the JVM.","Pin the java binary path in systemd unit files."],"tags":["process-launch","jvm","startup"],"backgroundTag":"command-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"}