janusgraph 0.5.2嵌入式cassandra java.lang.nosuchmethoderror:com.codahale.metrics.snapshot

ddarikpa  于 2021-07-03  发布在  Java
关注(0)|答案(1)|浏览(604)

我们正在使用嵌入式cassandra模式设置janusgraph 0.5.2。
在这种模式下启动janus时,它在日志中抛出以下异常:

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)

我在网上搜索了它,它似乎是一些专业的依赖性问题的度量核心。
有没有办法在janusgraph设置中解决这个问题?我们是否可以从日志中抑制此异常或禁用cassandra度量?
这在janus0.3.1中不常见
请帮忙

wwtsj6pe

wwtsj6pe1#

所以这个问题最终归结为codahale metrics核心jar的冲突版本。我相信cassandra目前依赖于3.1.5,而janusgraph(实际上是gremlin)附带了3.0.2和3.2.2。
其中一个解决方案是将3.0.2从 $JANUSGRAPH_HOME/lib .
但是,如果您不想混淆不同项目的库依赖关系,最好的解决方案可能是确保janusgraph和cassandra在单独的jvm中运行。

相关问题