spring-projects/spring-boot · warning · IllegalStateException

Interrupted while waiting for Spring Boot app to start.

Error message

Interrupted while waiting for Spring Boot app to start.

What it means

While sleeping between readiness retries via this.lock.wait(wait), InterruptedException indicates another thread interrupted the Maven build thread. The code restores the interrupt status (Thread.currentThread().interrupt()) and throws IllegalStateException, aborting the wait loop cleanly.

Solutions

  1. Avoid cancelling builds mid-startup when graceful start matters
  2. Increase CI timeout for spring-boot:start goals so they are not interrupted
  3. Do not run spring-boot:start in a thread you intend to interrupt
Defensive patterns

Strategy: try-catch

Try / catch

try { waitForSpringApplication(); } catch (IllegalStateException ex) { if (Thread.currentThread().isInterrupted()) { log.warn("Build thread was interrupted during start wait"); } throw ex; }

Prevention

When it happens

Trigger: IDE, CI watchdog, build timer, or user cancellation interrupting the Maven thread during the spring-boot:start wait loop.

Common situations: User cancelling the build mid-startup; CI job timeout firing; a parent process sending interrupt to the build thread.

Related errors


AI-assisted analysis of spring-projects/spring-boot@270dfe353f (2026-08-11). Data as JSON: /api/errors/14ba7ff93aff8233. Report an issue: GitHub.

Appendix: source

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

	 * @return the result
	 * @throws Exception in case of execution errors
	 */
	public <T> T execute(long wait, int maxAttempts, Callable<@Nullable T> callback) throws Exception {
		getLog().debug("Waiting for spring application to start...");
		for (int i = 0; i < maxAttempts; i++) {
			T result = callback.call();
			if (result != null) {
				return result;
			}
			String message = "Spring application is not ready yet, waiting " + wait + "ms (attempt " + (i + 1) + ")";
			getLog().debug(message);
			synchronized (this.lock) {
				try {
					this.lock.wait(wait);
				}
				catch (InterruptedException ex) {
					Thread.currentThread().interrupt();
					throw new IllegalStateException("Interrupted while waiting for Spring Boot app to start.");
				}
			}
		}
		throw new MojoExecutionException(
				"Spring application did not start before the configured timeout (" + (wait * maxAttempts) + "ms");
	}

	@Override
	protected TestClasspath testClasspath() {
		if (this.resolvedTestClasspath == null) {
			if (this.useTestClasspath != null) {
				getLog().warn("useTestClasspath is deprecated, use testClasspath instead.");
				this.resolvedTestClasspath = (this.useTestClasspath) ? TestClasspath.DEPENDENCIES : TestClasspath.OFF;
			}
			else {
				this.resolvedTestClasspath = TestClasspath.valueOf(this.testClasspath.toUpperCase(Locale.ROOT));
			}
		}

View on GitHub (pinned to 270dfe353f)