{"record":{"id":"56b0f8e91370d605","repo":"spring-projects/spring-boot","slug":"shutdown-failed","errorCode":null,"errorMessage":"Shutdown failed","messagePattern":"Shutdown failed","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java","lineNumber":90,"sourceCode":"\t\t\tthrow new MojoExecutionException(\"Failed to retrieve Ready attribute\", ex.getCause());\n\t\t}\n\t\tcatch (MBeanException | IOException ex) {\n\t\t\tthrow new MojoExecutionException(ex.getMessage(), ex);\n\t\t}\n\t}\n\n\t/**\n\t * Stop the application managed by this instance.\n\t * @throws MojoExecutionException if the JMX service could not be contacted\n\t * @throws IOException if an I/O error occurs\n\t * @throws InstanceNotFoundException if the lifecycle mbean cannot be found\n\t */\n\tvoid stop() throws MojoExecutionException, IOException, InstanceNotFoundException {\n\t\ttry {\n\t\t\tthis.connection.invoke(this.objectName, \"shutdown\", null, null);\n\t\t}\n\t\tcatch (ReflectionException ex) {\n\t\t\tthrow new MojoExecutionException(\"Shutdown failed\", ex.getCause());\n\t\t}\n\t\tcatch (MBeanException ex) {\n\t\t\tthrow new MojoExecutionException(\"Could not invoke shutdown operation\", ex);\n\t\t}\n\t}\n\n\tprivate ObjectName toObjectName(String name) {\n\t\ttry {\n\t\t\treturn new ObjectName(name);\n\t\t}\n\t\tcatch (MalformedObjectNameException ex) {\n\t\t\tthrow new IllegalArgumentException(\"Invalid jmx name '\" + name + \"'\");\n\t\t}\n\t}\n\n\t/**\n\t * Create a connector for an {@link javax.management.MBeanServer} exposed on the\n\t * current machine and the current port. Security should be disabled.","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/270dfe353fb830fd69b823a8a859287ff103854b/build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java#L72-L108","documentation":"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.","triggerScenarios":"The shutdown operation on the application's lifecycle MBean threw internally while being invoked reflectively.","commonSituations":"ApplicationContext.close() threw during shutdown; the MBean was unregistered between the existence check and the invoke; classloader issues during reflective call.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { client.stop(); } catch (MojoExecutionException ex) { Throwable root = ex.getCause(); log.error(\"Shutdown reflected failure: {}\", root); /* fall back to forced kill */ }","preventionTips":["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"],"tags":["jmx","shutdown","maven-plugin"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}