spring-projects/spring-boot · error · MojoExecutionException

Failed to connect to MBean server at port {}

Error message

Failed to connect to MBean server at port {}

What it means

Error "Failed to connect to MBean server at port {}" thrown in spring-projects/spring-boot.

Source

Thrown at build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java:155

	private void waitForSpringApplication() throws MojoFailureException, MojoExecutionException {
		try {
			getLog().debug("Connecting to local MBeanServer at port " + this.jmxPort);
			try (JMXConnector connector = execute(this.wait, this.maxAttempts, new CreateJmxConnector(this.jmxPort))) {
				if (connector == null) {
					throw new MojoExecutionException("JMX MBean server was not reachable before the configured "
							+ "timeout (" + (this.wait * this.maxAttempts) + "ms");
				}
				getLog().debug("Connected to local MBeanServer at port " + this.jmxPort);
				MBeanServerConnection connection = connector.getMBeanServerConnection();
				doWaitForSpringApplication(connection);
			}
		}
		catch (IOException ex) {
			throw new MojoFailureException("Could not contact Spring Boot application via JMX on port " + this.jmxPort
					+ ". Please make sure that no other process is using that port", ex);
		}
		catch (Exception ex) {
			throw new MojoExecutionException("Failed to connect to MBean server at port " + this.jmxPort, ex);
		}
	}

	private void doWaitForSpringApplication(MBeanServerConnection connection)
			throws MojoExecutionException, MojoFailureException {
		final SpringApplicationAdminClient client = new SpringApplicationAdminClient(connection, this.jmxName);
		try {
			Callable<@Nullable Boolean> isReady = () -> (client.isReady() ? true : null);
			execute(this.wait, this.maxAttempts, isReady);
		}
		catch (ReflectionException ex) {
			throw new MojoExecutionException("Unable to retrieve 'ready' attribute", ex.getCause());
		}
		catch (Exception ex) {
			throw new MojoFailureException("Could not invoke shutdown operation", ex);
		}
	}

View on GitHub (pinned to 5b2dbdbb8b)

When it happens

Trigger: Thrown at build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java:155 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of spring-projects/spring-boot@5b2dbdbb8b (2026-08-04). Data as JSON: /data/errors/1b019844f3270624.json. Report an issue: GitHub.