{"record":{"id":"2543b305155a998d","repo":"spring-projects/spring-boot","slug":"invalid-jmx-name-name","errorCode":null,"errorMessage":"Invalid jmx name '{name}'","messagePattern":"Invalid jmx name '(.+?)'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java","lineNumber":102,"sourceCode":"\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());\n\t\t}\n\t\tcatch (MBeanException ex) {\n\t\t\tthrow new MojoExecutionException(\"Could not invoke shutdown operation\", ex);\n\t\t}\n\t}\n\n\tprivate ObjectName toObjectName(String name) {\n\t\ttry {\n\t\t\treturn new ObjectName(name);\n\t\t}\n\t\tcatch (MalformedObjectNameException ex) {\n\t\t\tthrow new IllegalArgumentException(\"Invalid jmx name '\" + name + \"'\");\n\t\t}\n\t}\n\n\t/**\n\t * Create a connector for an {@link javax.management.MBeanServer} exposed on the\n\t * current machine and the current port. Security should be disabled.\n\t * @param port the port on which the mbean server is exposed\n\t * @return a connection\n\t * @throws IOException if the connection to that server failed\n\t */\n\tstatic JMXConnector connect(int port) throws IOException {\n\t\tString url = \"service:jmx:rmi:///jndi/rmi://127.0.0.1:\" + port + \"/jmxrmi\";\n\t\tJMXServiceURL serviceUrl = new JMXServiceURL(url);\n\t\treturn JMXConnectorFactory.connect(serviceUrl, null);\n\t}\n\n}\n","sourceCodeStart":84,"sourceCodeEnd":120,"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#L84-L120","documentation":"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.","triggerScenarios":"Setting the admin JMX name to a string that violates the ObjectName grammar (e.g. contains whitespace, missing 'key=value', unbalanced quotes).","commonSituations":"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.","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"],"exampleFix":"// before\n-Dspring-boot.application.admin.jmxName=my admin\n// after\n-Dspring-boot.application.admin.jmxName=org.springframework.boot:type=Admin,name=SpringApplication","handlingStrategy":"validation","validationCode":"try { javax.management.ObjectName.getInstance(name); }\ncatch (javax.management.MalformedObjectNameException e) { throw new IllegalArgumentException(\"Invalid JMX name: \" + name, e); }","typeGuard":null,"tryCatchPattern":"try { client.toObjectName(name); } catch (IllegalArgumentException ex) { log.error(\"jmxName misconfigured: {}\", name); throw ex; }","preventionTips":["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"],"tags":["jmx","configuration","maven-plugin"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}