解决java.lang.NoSuchMethodError: org.apache.zookeeper.ZooKeeper.<init>问题
今天启动 连接 zookeeper时,报如下错误:Exception in thread "main" java.lang.NoSuchMethodError: org.apache.zookeeper.ZooKeeper.<init>(Ljava/lang/String;ILorg/apache/zookeeper/Watcher;Z)Vat org.apache.curator.u
·
今天启动 连接 zookeeper时,报如下错误:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.zookeeper.ZooKeeper.<init>(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:213)
at org.apache.curator.HandleHolder$1.getZooKeeper(HandleHolder.java:100)
at org.apache.curator.HandleHolder.getZooKeeper(HandleHolder.java:48)
at org.apache.curator.ConnectionState.reset(ConnectionState.java:204)
at org.apache.curator.ConnectionState.start(ConnectionState.java:111)
at org.apache.curator.CuratorZookeeperClient.start(CuratorZookeeperClient.java:237)
at org.apache.curator.framework.imps.CuratorFrameworkImpl.start(CuratorFrameworkImpl.java:338)
at com.xuan.rpc.registry.impl.ZookeeperRegistryHandler.<init>(ZookeeperRegistryHandler.java:53)
at com.xuan.rpc.ServerBootstrap.main(ServerBootstrap.java:34)
原因:
之前使用 zkClient连接的zookeeper,现在改为了 Curator ,启动时报此问题
解决办法:
在pom.xml中去掉zkClient的依赖
<!--<dependency>-->
<!--<groupId>com.101tec</groupId>-->
<!--<artifactId>zkclient</artifactId>-->
<!--<version>0.2</version>-->
<!--</dependency>-->
更多推荐
已为社区贡献5条内容
所有评论(0)