首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

解决zookeeper linux上无法启动的有关问题

2012-07-01 
解决zookeeper linux下无法启动的问题在linux下安装zookeeper时,出现了如下的错误:??[hadoop@hadoop-maste

解决zookeeper linux下无法启动的问题

在linux下安装zookeeper时,出现了如下的错误:

?

?

[hadoop@hadoop-master bin]$ ./zkServer.sh startJMX disabled by user requestUsing config: /opt/zookeeper-3.3.3/bin/../conf/zoo.cfgStarting 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.cfg2011-07-05 10:33:57,596 - WARN  [main:QuorumPeerMain@105] - Either no config or no quorum defined in config, running  in standalone modeException 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)

?

?发现没有找到java.lang.management下的一个方法。如果使用的是标准的JDK的话,不应该出现这样的错误的。于是查看zkServer.sh的脚本。发现启动java程序的脚本如下:

?

java  "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \    -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" &

?

?在linux下直接执行java命令,发现输出如下:

?

[hadoop@hadoop-master bin]$ javaUsage: gij [OPTION] ... CLASS [ARGS] ...          to invoke CLASS.main, or       gij -jar [OPTION] ... JARFILE [ARGS] ...          to execute a jar fileTry `gij --help' for more information.

?

?显然,zkServer.sh使用的java不正确。使用的gij的java。解决这个问题就简单了,把脚本改成:

?

 $JAVA_HOME/bin/java  "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \    -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" &

?

这样修改之后,就能正常运行了。

?

?

热点排行