{"record":{"id":"97df7c76544986c3","repo":"apache/cassandra","slug":"configure-either-jmx-server-options-in-cassandra-y","errorCode":null,"errorMessage":"Configure either jmx_server_options in cassandra.yaml and comment out configure_jmx function call in cassandra-env.sh or keep cassandra-env.sh to call configure_jmx function but you have to keep jmx_server_options in cassandra.yaml commented out.","messagePattern":"Configure either jmx_server_options in cassandra\\.yaml and comment out configure_jmx function call in cassandra-env\\.sh or keep cassandra-env\\.sh to call configure_jmx function but you have to keep jmx_server_options in cassandra\\.yaml commented out\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":1161,"sourceCode":"                throw new ConfigurationException(\"native_transport_max_message_size must not exceed native_transport_max_request_data_in_flight\", false);\n\n            if (maxCqlMessageSize > conf.native_transport_max_request_data_in_flight_per_ip.toBytes())\n                throw new ConfigurationException(\"native_transport_max_message_size must not exceed native_transport_max_request_data_in_flight_per_ip\", false);\n\n        }\n        nativeTransportMaxMessageSizeInBytes = conf.native_transport_max_message_size.toBytes();\n\n        // native transport encryption options\n        if (conf.client_encryption_options != null)\n            conf.client_encryption_options.applyConfig();\n\n        if (conf.jmx_server_options == null)\n        {\n            conf.jmx_server_options = JMXServerOptions.createParsingSystemProperties();\n        }\n        else if (JMXServerOptions.isEnabledBySystemProperties())\n        {\n                throw new ConfigurationException(\"Configure either jmx_server_options in cassandra.yaml and comment out \" +\n                                                 \"configure_jmx function call in cassandra-env.sh or keep cassandra-env.sh \" +\n                                                 \"to call configure_jmx function but you have to keep jmx_server_options \" +\n                                                 \"in cassandra.yaml commented out.\");\n        }\n\n        conf.jmx_server_options.jmx_encryption_options.applyConfig();\n\n        if (conf.snapshot_links_per_second < 0)\n            throw new ConfigurationException(\"snapshot_links_per_second must be >= 0\");\n\n        if (conf.max_value_size.toMebibytes() == 0)\n            throw new ConfigurationException(\"max_value_size must be positive\", false);\n        else if (conf.max_value_size.toMebibytes() >= 2048)\n            throw new ConfigurationException(\"max_value_size must be smaller than 2048, but was \"\n                                             + conf.max_value_size.toString(), false);\n\n        switch (conf.disk_optimization_strategy)\n        {","sourceCodeStart":1143,"sourceCodeEnd":1179,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L1143-L1179","documentation":"JMX can be configured in exactly one of two ways: via jmx_server_options in cassandra.yaml, or via the configure_jmx function called from cassandra-env.sh (which reads system properties). DatabaseDescriptor throws this ConfigurationException when both are present at once — jmx_server_options is defined in yaml AND JMXServerOptions.isEnabledBySystemProperties() detects the configure_jmx system properties — because the two configurations would conflict.","triggerScenarios":"cassandra.yaml contains a non-null jmx_server_options block while cassandra-env.sh still calls configure_jmx (leaving jmx remote access / authentication system properties set), and DatabaseDescriptor.applySimpleConfig runs at startup.","commonSituations":"Admins editing cassandra.yaml to move JMX config into yaml but forgetting to comment out the configure_jmx call in cassandra-env.sh; automated images bundling both mechanisms; docs/tutorials from different Cassandra versions recommending different mechanisms.","solutions":["Comment out the configure_jmx call in conf/cassandra-env.sh (keeping jmx_server_options in cassandra.yaml)","Or comment out the jmx_server_options block in cassandra.yaml and keep using configure_jmx in cassandra-env.sh","Remove leftover JMX_REMOTE/COM_SUN_MANAGEMENT related system properties if configure_jmx was inlined elsewhere"],"exampleFix":"# before (cassandra-env.sh)\nJVM_OPTS=\"$JVM_OPTS -Dcassandra.jmx.remote.port=7199\"\nconfigure_jmx\n# after\n# configure_jmx  # jmx_server_options is used in cassandra.yaml instead","handlingStrategy":"validation","validationCode":"boolean yamlHasJmx = conf.jmx_server_options != null;\nboolean envHasJmx = System.getProperty(\"cassandra.jmx.remote.port\") != null;\nif (yamlHasJmx && envHasJmx) throw new IllegalStateException(\"Use either jmx_server_options or configure_jmx, not both\");","typeGuard":null,"tryCatchPattern":"try { DatabaseDescriptor.applyConfig(conf); } catch (ConfigurationException e) { if (e.getMessage().contains(\"jmx_server_options\")) { /* disable one JMX mechanism */ } }","preventionTips":["Pick one JMX configuration mechanism per node and document it","After moving JMX config into cassandra.yaml, always comment out configure_jmx in cassandra-env.sh","Grep deployment images for both mechanisms as a post-install check"],"tags":["cassandra","jmx","configuration"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}