spring-projects/spring-boot · error · MojoExecutionException

Process execution failed

Error message

Process execution failed

What it means

Thrown by JavaProcessExecutor.run (the synchronous run method) as a MojoExecutionException wrapping an IOException raised by RunProcess.run(true, ...). This represents a failure to start or communicate with the forked JVM itself, not the JVM exiting with a non-zero status (that is error 32). Common IOException sources here are missing java executable, broken pipe to the child, or inability to spawn the process.

Source

Thrown at build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/JavaProcessExecutor.java:80

				? this.runProcessCustomizer.andThen(customizer) : customizer;
		return new JavaProcessExecutor(this.mavenSession, this.toolchainManager, combinedCustomizer);
	}

	int run(File workingDirectory, List<String> args, Map<String, String> environmentVariables)
			throws MojoExecutionException {
		RunProcess runProcess = new RunProcess(workingDirectory, getJavaExecutable());
		if (this.runProcessCustomizer != null) {
			this.runProcessCustomizer.accept(runProcess);
		}
		try {
			int exitCode = runProcess.run(true, args, environmentVariables);
			if (!hasTerminatedSuccessfully(exitCode)) {
				throw new MojoExecutionException("Process terminated with exit code: " + exitCode);
			}
			return exitCode;
		}
		catch (IOException ex) {
			throw new MojoExecutionException("Process execution failed", ex);
		}
	}

	RunProcess runAsync(File workingDirectory, List<String> args, Map<String, String> environmentVariables)
			throws MojoExecutionException {
		try {
			RunProcess runProcess = new RunProcess(workingDirectory, getJavaExecutable());
			runProcess.run(false, args, environmentVariables);
			return runProcess;
		}
		catch (IOException ex) {
			throw new MojoExecutionException("Process execution failed", ex);
		}
	}

	private boolean hasTerminatedSuccessfully(int exitCode) {
		return (exitCode == 0 || exitCode == EXIT_CODE_SIGINT);
	}

View on GitHub (pinned to 5b2dbdbb8b)

Solutions

  1. Verify the java on PATH runs: `java -version`.
  2. If using Maven toolchains, check ~/.m2/toolchains.xml points at an existing JDK.
  3. Confirm spring-boot.run.workingDirectory exists and is a directory.
  4. Inspect the wrapped IOException message — it usually names the missing executable or the OS error.

Example fix

// before — toolchains.xml references a removed JDK
<toolchain>
  <type>jdk</type>
  <provides><version>17</version></provides>
  <configuration><jdkHome>/opt/jdk-17</jdkHome></configuration>
</toolchain>
// after — existing JDK home
<jdkHome>/usr/lib/jvm/java-17-openjdk</jdkHome>
Defensive patterns

Strategy: validation

Validate before calling

// Confirm java is on PATH / toolchain before running
import java.io.File;

void ensureJava(String toolchainJavaHome) {
    File java = (toolchainJavaHome != null)
        ? new File(toolchainJavaHome, "bin/java")
        : new File("/usr/bin/java"); // or use which-equivalent
    if (!java.canExecute()) throw new IllegalStateException("java not executable: " + java);
}

Prevention

When it happens

Trigger: The java executable resolved by JavaProcessExecutor.getJavaExecutable() does not exist or is not executable; the working directory does not exist; the OS refuses to spawn the process (too many open files, permissions); the toolchain-configured JDK path is broken; RunProcess loses its pipe to the child.

Common situations: A configured Maven toolchain points at a JDK that was since uninstalled; running in a container where /usr/bin/java is missing; ulimit exhaustion (EMFILE); the workingDirectory parameter points at a non-existent folder; PATH issues after a JDK upgrade.

Related errors


AI-assisted analysis of spring-projects/spring-boot@5b2dbdbb8b (2026-08-04). Data as JSON: /data/errors/0908c8394c7dc2fc.json. Report an issue: GitHub.