spring-projects/spring-boot · error · IllegalArgumentException
Invalid jmx name '{name}'
Error message
Invalid jmx name '{name}' What it means
toObjectName constructs a JMX ObjectName from a string (the configured spring-boot.application.admin.jmxName). If the value does not conform to the JMX ObjectName grammar (domain:key=value pairs, balanced quotes, valid characters), MalformedObjectNameException is wrapped as IllegalArgumentException.
Source
Thrown at build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java:102
*/
void stop() throws MojoExecutionException, IOException, InstanceNotFoundException {
try {
this.connection.invoke(this.objectName, "shutdown", null, null);
}
catch (ReflectionException ex) {
throw new MojoExecutionException("Shutdown failed", ex.getCause());
}
catch (MBeanException ex) {
throw new MojoExecutionException("Could not invoke shutdown operation", ex);
}
}
private ObjectName toObjectName(String name) {
try {
return new ObjectName(name);
}
catch (MalformedObjectNameException ex) {
throw new IllegalArgumentException("Invalid jmx name '" + name + "'");
}
}
/**
* Create a connector for an {@link javax.management.MBeanServer} exposed on the
* current machine and the current port. Security should be disabled.
* @param port the port on which the mbean server is exposed
* @return a connection
* @throws IOException if the connection to that server failed
*/
static JMXConnector connect(int port) throws IOException {
String url = "service:jmx:rmi:///jndi/rmi://127.0.0.1:" + port + "/jmxrmi";
JMXServiceURL serviceUrl = new JMXServiceURL(url);
return JMXConnectorFactory.connect(serviceUrl, null);
}
}
View on GitHub (pinned to 270dfe353f)
Solutions
- Provide a well-formed ObjectName: org.springframework.boot:type=Admin,name=SpringApplication
- Leave the default jmxName unless you have a specific reason to customize it
- Validate the value with javax.management.ObjectName.getInstance(name) before configuring
Example fix
// before -Dspring-boot.application.admin.jmxName=my admin // after -Dspring-boot.application.admin.jmxName=org.springframework.boot:type=Admin,name=SpringApplication
Defensive patterns
Strategy: validation
Validate before calling
try { javax.management.ObjectName.getInstance(name); }
catch (javax.management.MalformedObjectNameException e) { throw new IllegalArgumentException("Invalid JMX name: " + name, e); } Try / catch
try { client.toObjectName(name); } catch (IllegalArgumentException ex) { log.error("jmxName misconfigured: {}", name); throw ex; } Prevention
- Prefer the default jmxName unless you have a specific reason to customize
- Validate the ObjectName with ObjectName.getInstance before configuring
- Avoid whitespace and special characters in object-name values
When it happens
Trigger: Setting the admin JMX name to a string that violates the ObjectName grammar (e.g. contains whitespace, missing 'key=value', unbalanced quotes).
Common situations: Overriding spring-boot.application.admin.jmxName with a free-form string; copy-pasting a partial name; including illegal characters like newline or comma in values without quoting.
Related errors
- Failed to load layers configuration with name '%s': '%s' not
- Failed to generate build-info.properties. {ex.getMessage()}
- Invalid Docker configuration, either context or host can be
- '%s' is not within the valid range %s to %s
- Failed to parse arguments [{arguments}]
AI-assisted analysis of spring-projects/spring-boot@270dfe353f (2026-08-11).
Data as JSON: /api/errors/2543b305155a998d.
Report an issue: GitHub.