zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luke Stephenson <luke.stephen...@gmail.com>
Subject Re: Command Line arguments for ZooKeeper Java example
Date Thu, 30 Oct 2014 22:32:43 GMT
Hello,

Almost the same question was asked yesterday, so having a look at this
thread may help.
http://mail-archives.apache.org/mod_mbox/zookeeper-user/201410.mbox/%3CC143048FDA902A48AE0A6ABFA6D8E8D16886BE26@EXMBDB03.campus.ncl.ac.uk%3E

Make sure you have the slf4j dependency (I'd recommend using maven to
manage).

This was the response provided yesterday:

These are some examples of setting the class path in run time:

1- java -cp target/lib/*:target/*
edu.brown.cs.zkbenchmark.ZooKeeperBenchmark --conf benchmark.conf

2- java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App

3- javac -classpath
./log4j-1.2.16.jar:./slf4j-api-1.6.1.jar:./slf4j-log4j12-1.6.1.jar
LearnerLeaderACK/*.java
java -cp .:./log4j-1.2.16.jar:./slf4j-api-1.6.1.jar:./slf4j-log4j12-1.6.1.jar
LearnerLeaderACK/StartLeader


Ibrahim


Hope that helps


Luke



On 31 October 2014 08:19, Yogesh Patil <patyogesh@gmail.com> wrote:

> Hi
>
> I am first time ZooKeepe(ZK) user and trying my hands with the java example
> that is provided.
>
> If I understood the purpose of sample client application,
> 1. It subscribes to (Watches) server notifications
> 2. Writes to file if notification received
> 3. Starts/Stops executing the 'exec' commands given as 4th command line
> argument
>
> However I fail to test use it as I don't understand what should be the 3rd
> run time argument to run this.
>
> I used this - 127.0.0.1 test1 sample.txt ls -la commands line arguments and
> I am getting following error:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/slf4j/LoggerFactory
> at org.apache.zookeeper.ZooKeeper.<clinit>(ZooKeeper.java:94)
> at Executor.<init>(Executor.java:38)
> at Executor.main(Executor.java:59)
> Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
> at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> ... 3 more
>
> P.S. Codes for Executor and DataMonitor remains as it is given
>
>
> Can someone help me run it using correct cmd line arguments ?
>
>
>
> Thanks,
> Yogesh Patil
>

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