Tag Archives: Couldn’t find a way

Solve the problem of unable to start under zookeeper Linux

When installing zookeeper under Linux, the following error occurs:

[ hadoop@hadoop-master bin]$ ./ zkServer.sh start

JMX disabled by user request

Using config: /opt/zookeeper-3.3.3/bin/../conf/ zoo.cfg

Starting zookeeper …

STARTED

[ hadoop@hadoop-master bin]$ 2011-07-05 10:33:57,587 – INFO [ main:QuorumPeerConfig@90 ] – Reading configuration from: /opt/zookeeper-3.3.3/bin/../conf/ zoo.cfg

2011-07-05 10:33:57,596 – WARN [ main:QuorumPeerMain@105 ] – Either no config or no quorum defined in config, running in standalone mode

Exception in thread “main” java.lang.NoSuchMethodError : method java.lang.management . ManagementFactory.getPlatformMBeanServer with signature () Ljavax.management.MBeanServer ; was not found.

at org.apache.zookeeper . jmx.ManagedUtil.registerLog4jMBeans ( ManagedUtil.java:48 )

at org.apache.zookeeper . server.ZooKeeperServerMain.initializeAndRun ( ZooKeeperServerMain.java:73 )

at org.apache.zookeeper . server.ZooKeeperServerMain.main ( ZooKeeperServerMain.java:51 )

at org.apache.zookeeper . server.quorum.QuorumPeerMain .initializeAndRun( QuorumPeerMain.java:108 )

at org.apache.zookeeper . server.quorum.QuorumPeerMain .main( QuorumPeerMain.java:76 )

Found, not found java.lang.management The next way. If you are using the standard JDK, such an error should not occur. So check it out zkServer.sh Script. It is found that the script to start the Java program is as follows:

Bash code

java “- Dzookeeper.log.dir= ${ZOO_ LOG_ DIR}” “- Dzookeeper.root.logger= ${ZOO_ LOG4J_ PROP}” \

-cp “$CLASSPATH” $JVMFLAGS $ZOOMAIN “$ZOOCFG” &

Executing Java command directly under Linux, the output is as follows:

Bash code

[ hadoop@hadoop-master bin]$ java

Usage: gij [OPTION] … CLASS [ARGS] …

to invoke CLASS.main , or

gij -jar [OPTION] … JARFILE [ARGS] …

to execute a jar file

Try `gij –help’ for more information.

Obviously, zkServer.sh Incorrect java used. Use the Java of Gij. To solve this problem, simply change the script to:

Bash code

$JAVA_ HOME/bin/java “- Dzookeeper.log.dir= ${ZOO_ LOG_ DIR}” “- Dzookeeper.root.logger= ${ZOO_ LOG4J_ PROP}” \

-cp “$CLASSPATH” $JVMFLAGS $ZOOMAIN “$ZOOCFG” &

After this modification, it can run normally.

It is mainly to replace the system’s own Java path, so that he can identify his own installed Java (it’s better to delete the system’s own JDK before installing software)