spring-projects/spring-boot · error · MojoExecutionException
Shutdown failed
Error message
Shutdown failed
What it means
During stop(), invoking the 'shutdown' operation on the lifecycle MBean threw a ReflectionException, meaning the operation exists but its reflective invocation on the MBean failed. The cause is unwrapped (ex.getCause()) and surfaced as MojoExecutionException.
Solutions
- Inspect ex.getCause() for the real exception behind the reflection failure
- Review the application's shutdown logs for context-close errors
- If graceful stop is impossible, terminate the JVM directly and stop the goal
Defensive patterns
Strategy: try-catch
Try / catch
try { client.stop(); } catch (MojoExecutionException ex) { Throwable root = ex.getCause(); log.error("Shutdown reflected failure: {}", root); /* fall back to forced kill */ } Prevention
- Inspect the unwrapped cause of ReflectionException before retrying
- Keep the application context close path clean (no throwing @PreDestroy)
- Have a forced-kill fallback when graceful stop fails
When it happens
Trigger: The shutdown operation on the application's lifecycle MBean threw internally while being invoked reflectively.
Common situations: ApplicationContext.close() threw during shutdown; the MBean was unregistered between the existence check and the invoke; classloader issues during reflective call.
Related errors
- Could not invoke shutdown operation
- Spring application lifecycle JMX bean not found. Could not…
- Could not contact Spring Boot application via JMX on port
- Could not invoke shutdown operation
- Failed to connect to MBean server at port
AI-assisted analysis of spring-projects/spring-boot@270dfe353f (2026-08-11).
Data as JSON: /api/errors/56b0f8e91370d605.
Report an issue: GitHub.
Appendix: source
Thrown at build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java:90
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());
}
catch (MBeanException ex) {
throw new MojoExecutionException("Could not invoke shutdown operation", ex);
}
}
private ObjectName toObjectName(String name) {
try {
return new ObjectName(name);
}
catch (MalformedObjectNameException ex) {
throw new IllegalArgumentException("Invalid jmx name '" + name + "'");
}
}
/**
* Create a connector for an {@link javax.management.MBeanServer} exposed on the
* current machine and the current port. Security should be disabled.View on GitHub (pinned to 270dfe353f)