[
https://issues.apache.org/jira/browse/ZOOKEEPER-3647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17198174#comment-17198174
]
Christopher Tubbs commented on ZOOKEEPER-3647:
----------------------------------------------
[~pramahap] I ran into this also (for 3.6.2). I was relying on Maven to resolve
the dropwizard and snappy-java jars. However, those are marked as "provided".
So, in my project, one that launches ZooKeeper in code, and sets up its own
class path based on Maven dependencies, I could not rely on getting these jars
onto the class path by zkServer.sh. The workaround was to add a direct
dependency on dropwizard and snappy-java [in my own
pom.xml|https://github.com/revelc/zookeeper-maven-plugin/commit/097fbd9940294d5d8d5e5a588b6b88109db74043#diff-600376dffeb79835ede4a0b285078036]
I hope this helps.
> Exception in thread "main" java.lang.NoClassDefFoundError:
> com/codahale/metrics/Reservoir
> -----------------------------------------------------------------------------------------
>
> Key: ZOOKEEPER-3647
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3647
> Project: ZooKeeper
> Issue Type: Bug
> Components: build
> Reporter: Prachi Prakash
> Priority: Trivial
>
> After building successfully I was trying to run the ZooKeeperServerMain class
> with the zoo_sample.cfg and getting the following exception:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> com/codahale/metrics/ReservoirException in thread "main"
> java.lang.NoClassDefFoundError: com/codahale/metrics/Reservoir at
> org.apache.zookeeper.metrics.impl.DefaultMetricsProvider$DefaultMetricsContext.lambda$getSummary$2(DefaultMetricsProvider.java:126)
> at
> java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
> at
> org.apache.zookeeper.metrics.impl.DefaultMetricsProvider$DefaultMetricsContext.getSummary(DefaultMetricsProvider.java:122)
> at org.apache.zookeeper.server.ServerMetrics.<init>(ServerMetrics.java:74)
> at org.apache.zookeeper.server.ServerMetrics.<clinit>(ServerMetrics.java:44)
> at
> org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:132)
> at
> org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:112)
> at
> org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:67)Caused
> by: java.lang.ClassNotFoundException: *com.codahale.metrics.Reservoir* at
> java.net.URLClassLoader.findClass(URLClassLoader.java:381) at
> java.lang.ClassLoader.loadClass(ClassLoader.java:424) at
> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at
> java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 8 more
> Can anyone guide on how to rectify this, it uses
> <dropwizard.version>3.2.5</dropwizard.version> not the 4.x
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)