{"id":"f0135a8377d3719a","repo":"spring-projects/spring-boot","slug":"could-not-contact-spring-boot-application-via-jmx","errorCode":null,"errorMessage":"Could not contact Spring Boot application via JMX on port {}. Please make sure that no other process is using that port","messagePattern":"Could not contact Spring Boot application via JMX on port (.+?)\\. Please make sure that no other process is using that port","errorType":"exception","errorClass":"MojoFailureException","httpStatus":null,"severity":"error","filePath":"build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java","lineNumber":151,"sourceCode":"\t\tjvmArguments.getArgs().addAll(remoteJmxArguments);\n\t\treturn jvmArguments;\n\t}\n\n\tprivate void waitForSpringApplication() throws MojoFailureException, MojoExecutionException {\n\t\ttry {\n\t\t\tgetLog().debug(\"Connecting to local MBeanServer at port \" + this.jmxPort);\n\t\t\ttry (JMXConnector connector = execute(this.wait, this.maxAttempts, new CreateJmxConnector(this.jmxPort))) {\n\t\t\t\tif (connector == null) {\n\t\t\t\t\tthrow new MojoExecutionException(\"JMX MBean server was not reachable before the configured \"\n\t\t\t\t\t\t\t+ \"timeout (\" + (this.wait * this.maxAttempts) + \"ms\");\n\t\t\t\t}\n\t\t\t\tgetLog().debug(\"Connected to local MBeanServer at port \" + this.jmxPort);\n\t\t\t\tMBeanServerConnection connection = connector.getMBeanServerConnection();\n\t\t\t\tdoWaitForSpringApplication(connection);\n\t\t\t}\n\t\t}\n\t\tcatch (IOException ex) {\n\t\t\tthrow new MojoFailureException(\"Could not contact Spring Boot application via JMX on port \" + this.jmxPort\n\t\t\t\t\t+ \". Please make sure that no other process is using that port\", ex);\n\t\t}\n\t\tcatch (Exception ex) {\n\t\t\tthrow new MojoExecutionException(\"Failed to connect to MBean server at port \" + this.jmxPort, ex);\n\t\t}\n\t}\n\n\tprivate void doWaitForSpringApplication(MBeanServerConnection connection)\n\t\t\tthrows MojoExecutionException, MojoFailureException {\n\t\tfinal SpringApplicationAdminClient client = new SpringApplicationAdminClient(connection, this.jmxName);\n\t\ttry {\n\t\t\tCallable<@Nullable Boolean> isReady = () -> (client.isReady() ? true : null);\n\t\t\texecute(this.wait, this.maxAttempts, isReady);\n\t\t}\n\t\tcatch (ReflectionException ex) {\n\t\t\tthrow new MojoExecutionException(\"Unable to retrieve 'ready' attribute\", ex.getCause());\n\t\t}\n\t\tcatch (Exception ex) {","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/5b2dbdbb8be64415eb6552f81ff7c449c8d251e6/build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java#L133-L169","documentation":"Error \"Could not contact Spring Boot application via JMX on port {}. Please make sure that no other process is using that port\" thrown in spring-projects/spring-boot.","triggerScenarios":"Thrown at build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java:151 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"5b2dbdbb8be64415eb6552f81ff7c449c8d251e6","analyzedAt":"2026-08-04T18:53:14.967Z","schemaVersion":2}