简体   繁体   中英

JanusGraph 0.5.2 embedded cassandra java.lang.NoSuchMethodError: com.codahale.metrics.Snapshot

We are setting up JanusGraph 0.5.2 with embedded cassandra mode.
When we start Janus in this mode, it throws below exception in its logs:

org.apache.cassandra.service.CassandraDaemon - Exception in thread Thread[OptionalTasks:1,5,main]
java.lang.NoSuchMethodError: com.codahale.metrics.Snapshot: method <init>()V not found
    at org.apache.cassandra.metrics.DecayingEstimatedHistogramReservoir$EstimatedHistogramReservoirSnapshot.<init>(DecayingEstimatedHistogramReservoir.java:353)
    at org.apache.cassandra.metrics.DecayingEstimatedHistogramReservoir.getSnapshot(DecayingEstimatedHistogramReservoir.java:224)
    at com.codahale.metrics.Histogram.getSnapshot(Histogram.java:54)
    at com.codahale.metrics.Timer.getSnapshot(Timer.java:142)
    at org.apache.cassandra.db.ColumnFamilyStore$3.run(ColumnFamilyStore.java:446)
    at org.apache.cassandra.concurrent.DebuggableScheduledThreadPoolExecutor$UncomplainingRunnable.run(DebuggableScheduledThreadPoolExecutor.java:118)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

I searched it on net it seems to be some maven dependency issue of metrics-core.

Any way to resolve this in JanusGraph setup? Can we suppress this exception from logs or disable Cassandra metrics?
This does not used to occur in Janus 0.3.1

Please help

So this problem ultimately comes down to conflicting versions of the Codahale metrics-core JAR. I believe Cassandra is currently dependent on 3.1.5, and JanusGraph (Gremlin, actually) ships with (both) 3.0.2 and 3.2.2.

One solution out there involves removing 3.0.2 from $JANUSGRAPH_HOME/lib .

But if you don't want to mess around with library dependencies of different projects, the best solution is probably to ensure that JanusGraph and Cassandra run in separate JVMs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM