Cassandra Persistence dependencies causes NoClassDefFoundError: com/codahale/metrics/JmxReporter

This is not a Akka issue per se, but help will be appreciated. My project uses Akka with Cassandra Persistence actors and also use Janusgraph with Cassandra as the data store and Elastic as the index engine. Adding “com.typesafe.akka” %% “akka-persistence-cassandra” % “1.0.0” as a dependency causes my Janusgraph test to fail with: java.lang.ClassNotFoundException: com.codahale.metrics.JmxReporter. Without the Cassandra Persistence there is a transitive dependency loaded io.dropwizard.metrics:metrics-core 3.2.2, but with the Cassandra Persistence added the metrics-core 3.2.2 is evicted in favour of io.dropwizard.metrics:metrics-core 4.0.5 which cause my Janusgraph set-up to fail, since it relies on the older jar. I am not sure what SBT magic happens and if I can use both jars.

hi @iandebeer,

you will need to check for a newer version of Janusgraph that is compatible with metrics-core 4.0.x.

Another option, but it’s possible it will not work, is to add an exclusion to metrics-core 4.0.5 when adding the dependency to akka-persistence-cassandra. With the exclusion, you will prevent the eviction but you may have other issues because cassandra might want to use some api from metrics-core 4.0x that’s not available.


BTW, you are not the only user facing issues because of coda-hale metrics’ version collisions.

See for example.

Thanks for the response - fortunately it seems that Cassandra Persistence is backward compatible with io.dropwizard.metrics-core 3.2.2, so I excluded the 4.0.5 version from dependency tree and that seems to work.