{"record":{"id":"103882360464dbc5","repo":"apache/cassandra","slug":"jmx-settings-in-cassandra-yaml-or-cassandra-env-sh","errorCode":null,"errorMessage":"JMX settings in cassandra.yaml or cassandra-env.sh have been bypassed as the JMX connector server is already initialized. Please refer to cassandra.yaml or cassandra-env.sh for JMX configuration info","messagePattern":"JMX settings in cassandra\\.yaml or cassandra-env\\.sh have been bypassed as the JMX connector server is already initialized\\. Please refer to cassandra\\.yaml or cassandra-env\\.sh for JMX configuration info","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/service/CassandraDaemon.java","lineNumber":184,"sourceCode":"                String appenderName = metricName.substring(0, separator);\n                String metric = metricName.substring(separator + 1); // remove \".\"\n                CassandraMetricsRegistry.Metrics.register(DefaultNameFactory.createMetricName(appenderName, metric, null), meter);\n            }\n        });\n        logger = LoggerFactory.getLogger(CassandraDaemon.class);\n    }\n\n    private void maybeInitJmx()\n    {\n        // If the standard com.sun.management.jmxremote.port property has been set\n        // then the JVM agent will have already started up a default JMX connector\n        // server. This behaviour is deprecated, but some clients may be relying\n        // on it, so log a warning and skip setting up the server with the settings\n        // as configured in cassandra.yaml or cassandra-env.sh.\n        // See: CASSANDRA-11540 & CASSANDRA-11725\n        if (COM_SUN_MANAGEMENT_JMXREMOTE_PORT.isPresent())\n        {\n            logger.warn(\"JMX settings in cassandra.yaml or cassandra-env.sh have been bypassed as the JMX connector server is \" +\n                        \"already initialized. Please refer to cassandra.yaml or cassandra-env.sh for JMX configuration info\");\n            return;\n        }\n\n        JAVA_RMI_SERVER_RANDOM_ID.setBoolean(true);\n\n        JMXServerOptions jmxServerOptions = DatabaseDescriptor.getJmxServerOptions();\n        if (!jmxServerOptions.enabled)\n            return;\n\n        try\n        {\n            jmxServer = JMXServerUtils.createJMXServer(jmxServerOptions);\n        }\n        catch (IOException e)\n        {\n            exitOrFail(1, e.getMessage(), e.getCause());\n        }","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/CassandraDaemon.java#L166-L202","documentation":"Cassandra logs this warning during daemon setup when it detects that a JMX connector server was already initialized by other means (e.g. a remote connector created by jmxremote system properties handled elsewhere or an attach API agent). It skips applying the JMX settings from cassandra.yaml/cassandra-env.sh, so those configured settings are silently ignored.","triggerScenarios":"The daemon property COM_SUN_MANAGEMENT_JMXREMOTE_PORT is present (JMX remote was activated via com.sun.management.jmxremote.* system properties) and an external JMX connector server is already bound, so maybeInitJmx returns early without applying yaml/env configuration.","commonSituations":"Operators set both -Dcom.sun.management.jmxremote.port on the JVM command line and JMX settings in cassandra-env.sh/cassandra.yaml; running under a monitoring agent (e.g. Jolokia or attach-based agents) that opens its own JMX connector; copy-pasting legacy JMX flags into jvm-server.options after migrating JMX config into cassandra.yaml.","solutions":["Remove the com.sun.management.jmxremote.* JVM flags so Cassandra applies the JMX settings from cassandra.yaml/cassandra-env.sh","Or remove the duplicate JMX settings from cassandra.yaml/cassandra-env.sh and keep only the JVM flags, accepting the bypass","Verify with jcmd/JConsole which JMX connector is actually listening and confirm only one source of configuration"],"exampleFix":"// before (jvm-server.options)\n-Dcom.sun.management.jmxremote.port=7199\n-Dcom.sun.management.jmxremote.authenticate=false\n// after\n# flags removed; JMX configured solely in cassandra-env.sh / cassandra.yaml","handlingStrategy":"validation","validationCode":"// before starting Cassandra, ensure a single JMX config source\nString jmxPort = System.getProperty(\"com.sun.management.jmxremote.port\");\nif (jmxPort != null && cassandraYamlHasJmxSettings())\n    throw new IllegalStateException(\"JMX configured both via system properties and cassandra.yaml/env\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Configure JMX in exactly one place (prefer cassandra.yaml/cassandra-env.sh)","Audit jvm-server.options and JAVA_OPTS for com.sun.management.jmxremote.* flags","After startup, check the log for this warning to detect conflicting config early"],"tags":["jmx","configuration-conflict","deprecated"],"backgroundTag":"conflicting-config-options","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}