{"record":{"id":"46b44afe65a313ff","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 {jmxPort}. 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":167,"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":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/270dfe353fb830fd69b823a8a859287ff103854b/build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java#L149-L185","documentation":"IOException while communicating with the running Spring Boot app over JMX at jmxPort. Wrapped as MojoFailureException (a build failure, distinct from execution errors) and the message hints that another process may be using the port.","triggerScenarios":"JMX connection broke mid-handshake, or could not be established at all due to a port conflict or RMI-level IO failure.","commonSituations":"Two concurrent builds sharing the same jmxPort; firewall/SELinux blocking localhost RMI; application crashed during the readiness handshake.","solutions":["Pick a unique jmxPort per concurrent build: <configuration><jmxPort>9013</jmxPort></configuration>","Confirm the application process is alive and listening on the jmxPort","Disable parallel mvn runs that share a port, or assign jmxPort per build"],"exampleFix":"<!-- before -->\n<!-- default jmxPort, shared across builds -->\n<!-- after -->\n<configuration><jmxPort>9013</jmxPort></configuration>","handlingStrategy":"validation","validationCode":"// Ensure the jmxPort is free before starting\ntry (java.net.ServerSocket s = new java.net.ServerSocket(jmxPort)) { /* free */ }\ncatch (IOException e) { throw new IllegalStateException(\"jmxPort \" + jmxPort + \" already in use\", e); }","typeGuard":null,"tryCatchPattern":"try { waitForSpringApplication(); } catch (MojoFailureException ex) { log.error(\"JMX IO failure on port {} -- likely a port conflict\", jmxPort, ex); throw ex; }","preventionTips":["Assign a unique jmxPort per concurrent build","Disable parallel mvn runs that share a port","Verify the application process is alive before contacting JMX"],"tags":["jmx","networking","maven-plugin","port-conflict"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}