spring boot data cassandra reactive JmxReporter problem

I tried the the answers here, I don't know how but error still persisted. I read this from docs.datastax.com , where they talked about Moving JMX reporting in Metrics 4 to a separate module, metrics-jmx. Which they made clear that it might cause issues/errors.

To fix this, I just had to call this method .withoutJMXReporting() as in the below.

Cluster cluster = Cluster.builder()
        .withoutJMXReporting()
        .build();

You can follow quietly here


Including old version of library also fixes problem:

implementation("io.dropwizard.metrics:metrics-core:3.2.2")


instead of overriding cluster as mentionned by Andy Wilkinson, you could alternatively override getMetricsEnabled so that always returns false.

@Override
protected boolean getMetricsEnabled() { return false; }

The spring.data.cassandra.jmx-enabled property is used when Spring Boot is auto-configuring a Cassandra Cluster bean. By extending AbstractReactiveCassandraConfiguration, you are switching off this auto-configuration in favour of the Cluster bean that's created by AbstractClusterConfiguration which is a super-class of AbstractReactiveCassandraConfiguration. As a result, the property has no effect.

There are two ways that you can fix your problem:

  1. Remove your AbstractReactiveCassandraConfiguration sub-class and use the various spring.data.cassandra.* properties to configure things instead.
  2. Override cluster on AbstractClusterConfiguration in CassandraConfig, call super.cluster() to get the CassandraClusterFactoryBean and then call setJmxReportingEnabled(false) on the factory bean before returning it.

Alternatively, if you are not using Dropwizard elsewhere in your application, you may be able to downgrade to an older version that is compatible with Cassandra's JMX reporting by overriding the dropwizard-metrics.version property in your pom.xml or build.gradle.