Exception in thread "Thread-1" java.lang. NoClassDefFoundError: org/apache/log4j/jmx/ HierarchyDynamicMBean at org.apache.zookeeper.jmx. ManagedUtil. registerLog4jMBeans( ManagedUtil.java:50) at org.apache.zookeeper.server. quorum.QuorumPeerMain. runFromConfig(QuorumPeerMain. java:122) at com.complexible.stardog.pack. cli.ZkStart$1.run(ZkStart. java:119) at java.lang.Thread.run(Unknown Source) Caused by: java.lang. ClassNotFoundException: org.apache.log4j.jmx. HierarchyDynamicMBean at java.net.URLClassLoader$1.run( Unknown Source) at java.net.URLClassLoader$1.run( Unknown Source) at java.security. AccessController.doPrivileged( Native Method) at java.net.URLClassLoader. findClass(Unknown Source) at java.lang.ClassLoader. loadClass(Unknown Source) at sun.misc.Launcher$ AppClassLoader.loadClass( Unknown Source) at java.lang.ClassLoader. loadClass(Unknown Source) ... 4 more
简单说吧,这个问题折腾我一下午,后来发现是jar包冲突
因为我之前在 $JAVA_HOME/jre/lib/ext/ 添加过一个log4j的jar包,这里运行zk就报错了,
那么把 $JAVA_HOME/jre/lib/ext/ 的log4j 删了就好了