zoukankan      html  css  js  c++  java
  • zkclient中包引用不对,导致NoSuchMethodError

    Exception in thread "main" 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)
    at org.apache.curator.framework.imps.CuratorFrameworkImpl$2.newZooKeeper(CuratorFrameworkImpl.java:169)
    at org.apache.curator.HandleHolder$1.getZooKeeper(HandleHolder.java:94)
    at org.apache.curator.HandleHolder.getZooKeeper(HandleHolder.java:55)
    at org.apache.curator.ConnectionState.reset(ConnectionState.java:219)
    at org.apache.curator.ConnectionState.start(ConnectionState.java:103)
    at org.apache.curator.CuratorZookeeperClient.start(CuratorZookeeperClient.java:188)
    at org.apache.curator.framework.imps.CuratorFrameworkImpl.start(CuratorFrameworkImpl.java:234)
    at com.github.ddth.zookeeper.ZooKeeperClient._connect(ZooKeeperClient.java:534)
    at com.github.ddth.zookeeper.ZooKeeperClient.init(ZooKeeperClient.java:656)
    at com.github.ddth.kafka.KafkaClient.init(KafkaClient.java:117)
    at org.apache.myfaces.blank.ConsumerDemo5.main(ConsumerDemo5.java:20)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
    @btnguyen2k
     
    Owner
    Hi nidonglin, for some reasons maven pull an old version of Apache Zookeeper which does not have this method. I'm checking on this issue.
    A workaround for now is to add Apache Zookeeper 3.4.6+ explicitly to your project.
     
     
            <dependency>
                <groupId>com.github.sgroschupf</groupId>
                <artifactId>zkclient</artifactId>
                <version>0.1</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.zookeeper</groupId>
                        <artifactId>zookeeper</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
     
    默认会引入zookeeper3.3.3.jar,但curator2.7.0会默认依赖zookeeper3.6.jar

  • 相关阅读:
    SQLServer2000同步复制技术实现步骤作者
    权限管理数据表设计说明
    vps配置笔记(10)架设svn服务
    电子商务网站的10个易用性规则
    WebBrowser中显示乱码
    xampp apache 无法启动
    网站安全之XSS漏洞攻击以及防范措施
    IEnumerable
    深入了解ASP.NET运行内幕
    单IP泛域名绑定
  • 原文地址:https://www.cnblogs.com/zhucezmf/p/8250465.html
Copyright © 2011-2022 走看看