You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Raymond Xie <xi...@gmail.com> on 2019/09/18 03:12:28 UTC

zookeeper cannot be started after cfg changed

Hello,

I am using zookeeper 3.5.5

I installed it /opt

I modified the zoo.cfg to be:
# The number of milliseconds of each tick
tickTime=2000
initLimit=5
syncLimit=2
dataDir=/var/lib/zookeeperdata/1
clientPort=2181

server.1=pocnnr1n1:2888:3888
server.2=pocdnr1n1:2889:3889
server.3=pocdnr2n1:2890:3890

*I was able to start it with:*
[rxie@pocdnr1n1 apache-zookeeper-3.5.5]$ sudo bin/zkServer.sh start
conf/zoo.cfg

And then I realized I need to change the port from 2181 to 2182 for this is
the second zk node, so I made the change.

And then I am not able to start zookeeper, even after I reboot the server.
output is below:
ZooKeeper JMX enabled by default
Using config: conf/zoo.cfg
Starting zookeeper ... FAILED TO START

Log shows:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/zookeeper/
 server/quorum/QuorumPeerMain
Caused by: java.lang.ClassNotFoundException:
org.apache.zookeeper.server.quorum.
 QuorumPeerMain
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class:
org.apache.zookeeper.server.quorum.QuorumPeerMain
     .  Program will exit.


Can anyone enlighten me why it was ok for the first time but can't be
started after the port is updated to a non-default one? how can I fix it?

Thank you very much.




*Sincerely yours,*


*Raymond*

Re: zookeeper cannot be started after cfg changed

Posted by Norbert Kalmar <nk...@cloudera.com.INVALID>.
Hi,

zkServer.sh starts zookeeper by calling the main class, which it can't find
on the
classpath: ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"
It looks for the binaries in the bin folder, relative to its own path. (So
make sure you are calling the original script in bin or linking it).

Something is mixed up and missing from your classpath.

Regards,
Norbert

On Wed, Sep 18, 2019 at 5:12 AM Raymond Xie <xi...@gmail.com> wrote:

> Hello,
>
> I am using zookeeper 3.5.5
>
> I installed it /opt
>
> I modified the zoo.cfg to be:
> # The number of milliseconds of each tick
> tickTime=2000
> initLimit=5
> syncLimit=2
> dataDir=/var/lib/zookeeperdata/1
> clientPort=2181
>
> server.1=pocnnr1n1:2888:3888
> server.2=pocdnr1n1:2889:3889
> server.3=pocdnr2n1:2890:3890
>
> *I was able to start it with:*
> [rxie@pocdnr1n1 apache-zookeeper-3.5.5]$ sudo bin/zkServer.sh start
> conf/zoo.cfg
>
> And then I realized I need to change the port from 2181 to 2182 for this is
> the second zk node, so I made the change.
>
> And then I am not able to start zookeeper, even after I reboot the server.
> output is below:
> ZooKeeper JMX enabled by default
> Using config: conf/zoo.cfg
> Starting zookeeper ... FAILED TO START
>
> Log shows:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/zookeeper/
>  server/quorum/QuorumPeerMain
> Caused by: java.lang.ClassNotFoundException:
> org.apache.zookeeper.server.quorum.
>  QuorumPeerMain
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> Could not find the main class:
> org.apache.zookeeper.server.quorum.QuorumPeerMain
>      .  Program will exit.
>
>
> Can anyone enlighten me why it was ok for the first time but can't be
> started after the port is updated to a non-default one? how can I fix it?
>
> Thank you very much.
>
>
>
>
> *Sincerely yours,*
>
>
> *Raymond*
>