You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "eric lee (Jira)" <ji...@apache.org> on 2021/11/22 08:59:00 UTC

[jira] [Commented] (ZOOKEEPER-3647) Exception in thread "main" java.lang.NoClassDefFoundError: com/codahale/metrics/Reservoir

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-3647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17447257#comment-17447257 ] 

eric lee commented on ZOOKEEPER-3647:
-------------------------------------

there is no problem in zk for your question. See the zkServer.sh or zkServer.cmd. you will find that  

-cp "%CLASSPATH%"

was specified. because of this path is different from your runtime. if you run zk with IDE(such as intellij idea), you can view the the info in console of Run Tab. the cmd specify only some of jars and classes dir. alse, you can view the UI of Run/Debug Configurations. it's default value is -cp zookeeper. you can click "Modify options" and then select "Add dependencies with 'provided' scope to classpath " with pop out list. Apply this modify, then run it again.

> 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.20.1#820001)