zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Churu Tang <ct...@rubiconproject.com>
Subject Re: How to run a simple Java Client
Date Wed, 29 Oct 2014 22:00:28 GMT
Hi Cameron,

Thank you for your explaining! I followed your guide then another error occurs.

$ java -cp ./:zookeeper-3.4.6.jar  ZKClient
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
	at org.apache.zookeeper.ZooKeeper.<clinit>(ZooKeeper.java:94)
	at ZKClient.main(ZKClient.java:19)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
	at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
	... 2 more

My best guess is that I need to include the ./lib/slf4j-log4j12-1.6.1.jar. But again I am
having the following java.lang.NoClassDefFoundError Watcher error, which I had before.

$ java -cp "./:zookeeper-3.4.6.jar;./lib/slf4j-log4j12-1.6.1.jar"  ZKClient
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/zookeeper/Watcher
Caused by: java.lang.ClassNotFoundException: org.apache.zookeeper.Watcher
	at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: ZKClient. Program will exit.

Also, would you tell me why there is a colon “:” in "./:zookeeper-3.4.6.jar”? I try
to google but unable to find it. Sorry for the naive question. Thanks!


Cheers,
Churu

On Oct 29, 2014, at 2:31 PM, Cameron McKenzie <mckenzie.cam@gmail.com> wrote:

> java -cp ./:zookeeper-3.4.6.jar ZKClient


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message