spring-projects/spring-boot · error · MojoExecutionException
Failed to retrieve Ready attribute
Error message
Failed to retrieve Ready attribute
What it means
ReflectionException from getAttribute("Ready") indicates the MBean exists and exposes the attribute, but invoking the underlying getter threw. The wrapper unwraps ex.getCause() and reports it as a MojoExecutionException so the build fails with the root reason.
Solutions
- Inspect the wrapped cause (ex.getCause()) in the stack trace for the actual failure
- Check the application's startup logs for context initialization errors
- Reproduce with mvn -X to capture full JMX diagnostics
Defensive patterns
Strategy: try-catch
Try / catch
try { client.isReady(); } catch (MojoExecutionException ex) { Throwable root = ex.getCause(); log.error("Ready attribute retrieval failed: {}", root); /* surface root cause */ } Prevention
- Inspect the unwrapped cause rather than the wrapper message
- Capture full application logs during the readiness window
- Reproduce with mvn -X for verbose JMX diagnostics
When it happens
Trigger: The isReady() getter on the lifecycle MBean threw because the ApplicationContext is in a broken state during the ready check (e.g. context threw during refresh).
Common situations: Application started enough to register the admin bean but its context failed mid-init; race between context close and ready poll.
Related errors
- Could not invoke shutdown operation
- Unable to retrieve 'ready' attribute
- Unexpected: attribute 'Ready' not available
- A jar or war file is required for building image
- Could not contact Spring Boot application via JMX on port
AI-assisted analysis of spring-projects/spring-boot@270dfe353f (2026-08-11).
Data as JSON: /api/errors/07bf5a473cb91206.
Report an issue: GitHub.
Appendix: source
Thrown at build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java:72
/**
* Check if the spring application managed by this instance is ready. Returns
* {@code false} if the mbean is not yet deployed so this method should be repeatedly
* called until a timeout is reached.
* @return {@code true} if the application is ready to service requests
* @throws MojoExecutionException if the JMX service could not be contacted
*/
boolean isReady() throws MojoExecutionException {
try {
return (Boolean) this.connection.getAttribute(this.objectName, "Ready");
}
catch (InstanceNotFoundException ex) {
return false; // Instance not available yet
}
catch (AttributeNotFoundException ex) {
throw new IllegalStateException("Unexpected: attribute 'Ready' not available", ex);
}
catch (ReflectionException ex) {
throw new MojoExecutionException("Failed to retrieve Ready attribute", ex.getCause());
}
catch (MBeanException | IOException ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
}
}
/**
* Stop the application managed by this instance.
* @throws MojoExecutionException if the JMX service could not be contacted
* @throws IOException if an I/O error occurs
* @throws InstanceNotFoundException if the lifecycle mbean cannot be found
*/
void stop() throws MojoExecutionException, IOException, InstanceNotFoundException {
try {
this.connection.invoke(this.objectName, "shutdown", null, null);
}
catch (ReflectionException ex) {
throw new MojoExecutionException("Shutdown failed", ex.getCause());View on GitHub (pinned to 270dfe353f)