解决org.apache.zookeeper.ZooKeeper.(Ljava/lang/String;ILorg/apache/zookeeper/Watcher;Z)V

报错

java.lang.NoSuchMethodError: org.apache.zookeeper.ZooKeeper.(Ljava/lang/String;ILorg/apache/zookeeper/Watcher;Z)V
    at org.apache.curator.utils.DefaultZookeeperFactory.newZooKeeper(DefaultZookeeperFactory.java:29) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.framework.imps.CuratorFrameworkImpl$2.newZooKeeper(CuratorFrameworkImpl.java:150) ~[curator-framework-2.10.0.jar:?]
    at org.apache.curator.HandleHolder$1.getZooKeeper(HandleHolder.java:94) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.HandleHolder.getZooKeeper(HandleHolder.java:55) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.ConnectionState.reset(ConnectionState.java:218) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.ConnectionState.start(ConnectionState.java:103) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.CuratorZookeeperClient.start(CuratorZookeeperClient.java:190) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.framework.imps.CuratorFrameworkImpl.start(CuratorFrameworkImpl.java:259) ~[curator-framework-2.10.0.jar:?]
    at org.apache.storm.kafka.ZkState.(ZkState.java:62) ~[storm-kafka-1.0.0.jar:1.0.0]
    at org.apache.storm.kafka.KafkaSpout.open(KafkaSpout.java:75) ~[storm-kafka-1.0.0.jar:1.0.0]
    at org.apache.storm.daemon.executor$fn__7877$fn__7892.invoke(executor.clj:602) ~[storm-core-1.0.0.jar:1.0.0]
    at org.apache.storm.util$async_loop$fn__625.invoke(util.clj:482) [storm-core-1.0.0.jar:1.0.0]
    at clojure.lang.AFn.run(AFn.java:22) [clojure-1.7.0.jar:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
21164 [Thread-24-kafkaSpout-executor[6 6]] ERROR o.a.s.d.executor - 
java.lang.NoSuchMethodError: org.apache.zookeeper.ZooKeeper.(Ljava/lang/String;ILorg/apache/zookeeper/Watcher;Z)V
    at org.apache.curator.utils.DefaultZookeeperFactory.newZooKeeper(DefaultZookeeperFactory.java:29) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.framework.imps.CuratorFrameworkImpl$2.newZooKeeper(CuratorFrameworkImpl.java:150) ~[curator-framework-2.10.0.jar:?]
    at org.apache.curator.HandleHolder$1.getZooKeeper(HandleHolder.java:94) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.HandleHolder.getZooKeeper(HandleHolder.java:55) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.ConnectionState.reset(ConnectionState.java:218) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.ConnectionState.start(ConnectionState.java:103) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.CuratorZookeeperClient.start(CuratorZookeeperClient.java:190) ~[curator-client-2.10.0.jar:?]
    at org.apache.curator.framework.imps.CuratorFrameworkImpl.start(CuratorFrameworkImpl.java:259) ~[curator-framework-2.10.0.jar:?]
    at org.apache.storm.kafka.ZkState.(ZkState.java:62) ~[storm-kafka-1.0.0.jar:1.0.0]
    at org.apache.storm.kafka.KafkaSpout.open(KafkaSpout.java:75) ~[storm-kafka-1.0.0.jar:1.0.0]
    at org.apache.storm.daemon.executor$fn__7877$fn__7892.invoke(executor.clj:602) ~[storm-core-1.0.0.jar:1.0.0]
    at org.apache.storm.util$async_loop$fn__625.invoke(util.clj:482) [storm-core-1.0.0.jar:1.0.0]
    at clojure.lang.AFn.run(AFn.java:22) [clojure-1.7.0.jar:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
21829 [Thread-24-kafkaSpout-executor[6 6]] ERROR o.a.s.util - Halting process: ("Worker died")
java.lang.RuntimeException: ("Worker died")
    at org.apache.storm.util$exit_process_BANG_.doInvoke(util.clj:341) [storm-core-1.0.0.jar:1.0.0]
    at clojure.lang.RestFn.invoke(RestFn.java:423) [clojure-1.7.0.jar:?]
    at org.apache.storm.daemon.worker$fn__8546$fn__8547.invoke(worker.clj:758) [storm-core-1.0.0.jar:1.0.0]
    at org.apache.storm.daemon.executor$mk_executor_data$fn__7765$fn__7766.invoke(executor.clj:271) [storm-core-1.0.0.jar:1.0.0]
    at org.apache.storm.util$async_loop$fn__625.invoke(util.clj:494) [storm-core-1.0.0.jar:1.0.0]
    at clojure.lang.AFn.run(AFn.java:22) [clojure-1.7.0.jar:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]

原因

有不同版本的zookeeper的jar包引入所致

解决办法

找到重复的jar包并去掉不需要的
至于详细的去掉jar包的方法:
在eclipse中可以参考这篇博文
在idea中可以参考这篇博文

ps:原因参考自知乎问答

你可能感兴趣的:(Bigdata,Zookeeper)