spring-projects/spring-boot · error · MojoExecutionException

Unable to retrieve 'ready' attribute

Error message

Unable to retrieve 'ready' attribute

What it means

In doWaitForSpringApplication, after the connector is open the plugin polls client.isReady() through the retry executor. ReflectionException escaping that poll is unwrapped: the lifecycle MBean exists but the underlying attribute access reflected an error. Reported as MojoExecutionException with the cause.

Solutions

  1. Inspect ex.getCause() for the real failure
  2. Check the application startup logs for early context failures
  3. Increase <wait> if startup is slow and the bean is in a transient state
Defensive patterns

Strategy: try-catch

Try / catch

try { doWaitForSpringApplication(connection); } catch (MojoExecutionException ex) { Throwable root = ex.getCause(); log.error("Ready poll reflected an error: {}", root); throw ex; }

Prevention

When it happens

Trigger: The application lifecycle MBean's Ready getter could not be invoked reflectively (the MBean target threw).

Common situations: Application initialization partially failed but the admin bean is registered; classloader rotation between registration and read; the bean was being unregistered during the poll.

Related errors


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

Appendix: source

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

		}
		catch (IOException ex) {
			throw new MojoFailureException("Could not contact Spring Boot application via JMX on port " + this.jmxPort
					+ ". Please make sure that no other process is using that port", ex);
		}
		catch (Exception ex) {
			throw new MojoExecutionException("Failed to connect to MBean server at port " + this.jmxPort, ex);
		}
	}

	private void doWaitForSpringApplication(MBeanServerConnection connection)
			throws MojoExecutionException, MojoFailureException {
		final SpringApplicationAdminClient client = new SpringApplicationAdminClient(connection, this.jmxName);
		try {
			Callable<@Nullable Boolean> isReady = () -> (client.isReady() ? true : null);
			execute(this.wait, this.maxAttempts, isReady);
		}
		catch (ReflectionException ex) {
			throw new MojoExecutionException("Unable to retrieve 'ready' attribute", ex.getCause());
		}
		catch (Exception ex) {
			throw new MojoFailureException("Could not invoke shutdown operation", ex);
		}
	}

	/**
	 * Execute a task, retrying it on failure.
	 * @param <T> the result type
	 * @param wait the wait time
	 * @param maxAttempts the maximum number of attempts
	 * @param callback the task to execute (possibly multiple times). The callback should
	 * return {@code null} to indicate that another attempt should be made
	 * @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...");

View on GitHub (pinned to 270dfe353f)