{"record":{"id":"07bf5a473cb91206","repo":"spring-projects/spring-boot","slug":"failed-to-retrieve-ready-attribute","errorCode":null,"errorMessage":"Failed to retrieve Ready attribute","messagePattern":"Failed to retrieve Ready attribute","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":72,"sourceCode":"\t/**\n\t * Check if the spring application managed by this instance is ready. Returns\n\t * {@code false} if the mbean is not yet deployed so this method should be repeatedly\n\t * called until a timeout is reached.\n\t * @return {@code true} if the application is ready to service requests\n\t * @throws MojoExecutionException if the JMX service could not be contacted\n\t */\n\tboolean isReady() throws MojoExecutionException {\n\t\ttry {\n\t\t\treturn (Boolean) this.connection.getAttribute(this.objectName, \"Ready\");\n\t\t}\n\t\tcatch (InstanceNotFoundException ex) {\n\t\t\treturn false; // Instance not available yet\n\t\t}\n\t\tcatch (AttributeNotFoundException ex) {\n\t\t\tthrow new IllegalStateException(\"Unexpected: attribute 'Ready' not available\", ex);\n\t\t}\n\t\tcatch (ReflectionException ex) {\n\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());","sourceCodeStart":54,"sourceCodeEnd":90,"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#L54-L90","documentation":"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.","triggerScenarios":"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).","commonSituations":"Application started enough to register the admin bean but its context failed mid-init; race between context close and ready poll.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { client.isReady(); } catch (MojoExecutionException ex) { Throwable root = ex.getCause(); log.error(\"Ready attribute retrieval failed: {}\", root); /* surface root cause */ }","preventionTips":["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"],"tags":["jmx","lifecycle","maven-plugin"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}