title: Starting Zookeeper Cluster. Error: Could not find or load main class org.apache.zookeeper.server.quorum.QuorumPeerMain
body: <p>(I'm running on CentOS 5.8). I've been following the direction for a <a href="http://zookeeper.apache.org/doc/r3.3.3/zookeeperAdmin.html#sc_zkMulitServerSetup" rel="noreferrer">Clustered (Multiserver) Zookeeper Set-up</a>, but getting an error when I try to start up my server. When I run the command as described in the documentation:</p>
  
  <pre><code>java -cp zookeeper-3.4.6.jar:lib/log4j-1.2.16.jar:conf \ org.apache.zookeeper.server.quorum.QuorumPeerMain conf/zoo.cfg 
  </code></pre>
  
  <p>I get the error: </p>
  
  <pre><code>Error: Could not find or load main class  org.apache.zookeeper.server.quorum.QuorumPeerMain
  </code></pre>
  
  <p>I have my files location as such and am running from the ~/zookeeper-3.4.6 directory:</p>
  
  <pre><code>~/zookeeper-3.4.6/zookeeper-3.4.6.jar 
  ~/zookeeper-3.4.6/conf/zoo.cfg
  ~/zookeeper-3.4.6/data/myid
  ~/zookeeper-3.4.6/lib/log4j-1.2.16.jar
  ~/zookeeper-3.4.6/bin/zkServer.sh
  </code></pre>
  
  <p>Does anyone know why this error is happening? I don't quite understand the arguments that are being passed, so it is hard for me to debug the path issue. As a side note, I've tried running <code>./zookeeper-3.4.6/bin/zkServer.sh start</code>, which did successfully work, but the documentation seems to indicate that command is meant for a single-node instance. </p>
  
  <p><strong>Edit</strong>:</p>
  
  <p>I was able to make <em>some</em> progress by modifying the command and taking out the <code>:conf \</code> part, so now I'm running:</p>
  
  <pre><code>java -cp zookeeper-3.4.6.jar:lib/log4j-1.2.16.jar: org.apache.zookeeper.server.quorum.QuorumPeerMain conf/zoo.cfg
  </code></pre>
  
  <p>I get a new error, but this is progress...</p>
  
  <pre class="lang-html prettyprint-override"><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFacto
  ry
          at org.apache.zookeeper.server.quorum.QuorumPeerMain.&lt;clinit&gt;(QuorumPeer
  Main.java:64)
  Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
          at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
          at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
          ... 1 more
  </code></pre>
  
  
  
  <p>which corresponds to lines 63 and 64 from QuorumPeerMain</p>
  
  <pre><code>public class QuorumPeerMain {
      private static final Logger LOG = LoggerFactory.getLogger(QuorumPeerMain.class);
  </code></pre>