{"record":{"id":"b90b67ce5a115499","repo":"brettwooldridge/HikariCP","slug":"poolname-cannot-contain-when-used-with-jmx","errorCode":null,"errorMessage":"poolName cannot contain ':' when used with JMX","messagePattern":"poolName cannot contain ':' when used with JMX","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/com/zaxxer/hikari/HikariConfig.java","lineNumber":1051,"sourceCode":"            throw new RuntimeException(\"Failed to copy HikariConfig state: \" + e.getMessage(), e);\n         }\n      }\n\n      other.sealed = false;\n   }\n\n   // ***********************************************************************\n   //                          Private methods\n   // ***********************************************************************\n\n   @SuppressWarnings(\"StatementWithEmptyBody\")\n   public void validate()\n   {\n      if (poolName == null) {\n         poolName = generatePoolName();\n      }\n      else if (isRegisterMbeans && poolName.contains(\":\")) {\n         throw new IllegalArgumentException(\"poolName cannot contain ':' when used with JMX\");\n      }\n\n      // treat empty property as null\n      //noinspection NonAtomicOperationOnVolatileField\n      catalog = getNullIfEmpty(catalog);\n      connectionInitSql = getNullIfEmpty(connectionInitSql);\n      connectionTestQuery = getNullIfEmpty(connectionTestQuery);\n      transactionIsolationName = getNullIfEmpty(transactionIsolationName);\n      dataSourceClassName = getNullIfEmpty(dataSourceClassName);\n      dataSourceJndiName = getNullIfEmpty(dataSourceJndiName);\n      driverClassName = getNullIfEmpty(driverClassName);\n      jdbcUrl = getNullIfEmpty(jdbcUrl);\n\n      // Check Data Source Options\n      if (dataSource != null) {\n         if (dataSourceClassName != null) {\n            LOGGER.warn(\"{} - using dataSource and ignoring dataSourceClassName.\", poolName);\n         }","sourceCodeStart":1033,"sourceCodeEnd":1069,"githubUrl":"https://github.com/brettwooldridge/HikariCP/blob/a4d93f4f85517f90e632b795486d7102e933d7ff/src/main/java/com/zaxxer/hikari/HikariConfig.java#L1033-L1069","documentation":"During validate() — run when the pool starts — HikariCP generates a JMX ObjectName from poolName, and ':' is the ObjectName property separator, so a poolName containing ':' with isRegisterMbeans=true throws IllegalArgumentException. The check only fires when JMX registration is enabled; colons are otherwise acceptable.","triggerScenarios":"config.setPoolName(\"prod:orders\") together with config.setRegisterMbeans(true); property files setting poolName with a host:port-style value; Spring Boot apps enabling MBean registration (spring.datasource.hikari.register-mbeans=true) with a colon-containing pool name.","commonSituations":"Naming pools after environments or hosts like 'db-replica:5432'; embedding URLs or service identifiers with colons in the pool name; enabling JMX for monitoring (Jolokia, Prometheus JMX exporter) on an existing app whose pool names already contain colons.","solutions":["Remove ':' from the pool name — use '-', '_' or '.' as separators (e.g. 'prod-orders')","Or turn off JMX registration (registerMbeans=false) if MBeans are not needed","If multiple pools must be distinguished, keep names JMX-safe from the start"],"exampleFix":"# before\nspring.datasource.hikari.pool-name=orders-db:5432\nspring.datasource.hikari.register-mbeans=true # IllegalArgumentException at startup\n\n# after\nspring.datasource.hikari.pool-name=orders-db-5432\nspring.datasource.hikari.register-mbeans=true","handlingStrategy":"validation","validationCode":"if (config.isRegisterMbeans() && poolName != null && poolName.contains(\":\")) {\n   throw new IllegalArgumentException(\"poolName '\" + poolName + \"' contains ':' which is illegal with JMX registration\");\n}\nconfig.setPoolName(poolName);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict pool names to [A-Za-z0-9_.-] by convention","Sanitize generated names (host:port -> host-port) before assigning them to pools","Add a config-lint test that validates all pool names against a JMX-safe pattern"],"tags":["hikaricp","configuration","jmx","pool-name","monitoring"],"backgroundTag":null,"analyzedSha":"a4d93f4f85517f90e632b795486d7102e933d7ff","analyzedAt":"2026-08-14T12:11:37.292Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}