JanusGraph / janusgraph

JanusGraph: an open-source, distributed graph database
https://janusgraph.org
Other
5.27k stars 1.16k forks source link

Graphite reporting fail to start - java.lang.NoSuchMethodError: com.codahale.metrics.ScheduledReporter. #2058

Open plemanach opened 4 years ago

plemanach commented 4 years ago

Please post all questions and issues on janusgraph-users before opening a GitHub issue. Your questions will reach a wider audience there, and if we confirm that there is a bug, then you can open a new issue.

Please include configurations and logs if available.

For confirmed bugs, please report:

Setup reporting graphite metrics.enabled = true metrics.graphite.hostname=graphite.rdxnidemo-infra.svc.cluster.local metrics.graphite.interval=60000

Stack Trace (if you have one)

could not be instantiated and will not be available in Gremlin Server.  GraphFactory message: GraphFactory could not instantiate this Graph implementation [class org.janusgraph.core.JanusGraphFactory]
java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [class org.janusgraph.core.JanusGraphFactory]
    at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:81)
    at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:69)
    at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:103)
    at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.lambda$new$0(DefaultGraphManager.java:57)
    at java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:671)
    at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.<init>(DefaultGraphManager.java:55)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:80)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:122)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:86)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:345)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:77)
    ... 13 more
Caused by: java.lang.NoSuchMethodError: com.codahale.metrics.ScheduledReporter.<init>(Lcom/codahale/metrics/MetricRegistry;Ljava/lang/String;Lcom/codahale/metrics/MetricFilter;Ljava/util/concurrent/TimeUnit;Ljava/util/concurrent/TimeUnit;Ljava/util/concurrent/ScheduledExecutorService;ZLjava/util/Set;)V
    at com.codahale.metrics.graphite.GraphiteReporter.<init>(GraphiteReporter.java:223)
    at com.codahale.metrics.graphite.GraphiteReporter$Builder.build(GraphiteReporter.java:179)
    at com.codahale.metrics.graphite.GraphiteReporter$Builder.build(GraphiteReporter.java:168)
    at org.janusgraph.util.stats.MetricManager.addGraphiteReporter(MetricManager.java:350)
    at org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.configureMetricsGraphiteReporter(GraphDatabaseConfiguration.java:1519)
    at org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.configureMetrics(GraphDatabaseConfiguration.java:1457)
    at org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.preLoadConfiguration(GraphDatabaseConfiguration.java:1438)
    at org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1244)
    at org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder.build(GraphDatabaseConfigurationBuilder.java:72)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:161)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:132)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:112)
    ... 18 more
plemanach commented 4 years ago

I worked around by removing lib/metrics-core-3.0.2.jar duplicate of metrics-core-3.2.2.jar.

porunov commented 4 years ago

metrics-core-3.0.2 is a transitive dependency from org.apache.tinkerpop:gremlin-server:3.4.6. I didn't check if it can be upgraded in gremlin-server. Most likely it could be upgraded without any problems and we the issue will be resolved by its own when upgrading to a newer tinkerpop version (with metrics-core update). Here is a tinkerpop pom where the upgrade should happen: https://github.com/apache/tinkerpop/tree/3.4-dev

doryosef commented 4 years ago

Failed on same issue with version 0.5.2 docker image thanks to @plemanach I was able to solve it by first first install metrics-graphite and then delete it from lib bin/gremlin-server.sh install com.codahale.metrics metrics-graphite 3.0.2 rm -f /opt/janusgraph/lib/metrics-core-3.0.2.jar