gpt4 book ai didi

java - Apache Curator TestServer 创建抛出 java.lang.NoSuchMethodError

转载 作者:行者123 更新时间:2023-12-02 08:41:01 28 4
gpt4 key购买 nike

我试图运行一个测试服务器以便能够为其编写单元测试。

    val zkServer = new TestingServer(2182)
println(zkServer.getPort)

我的pom有以下与Curator相关的依赖项,我尝试过版本4.2.0和4.3.0,都抛出相同的错误:

    <dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>${apache.curator.version}</version>
</dependency>


<!-- https://mvnrepository.com/artifact/org.apache.curator/curator-recipes -->
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>${apache.curator.version}</version>
</dependency>

<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-test</artifactId>
<version>${apache.curator.version}</version>
</dependency>

抛出的错误是这样的:

Exception in thread "Thread-0" java.lang.NoSuchMethodError: org.apache.zookeeper.server.ZooKeeperServer.<init>(Lorg/apache/zookeeper/server/persistence/FileTxnSnapLog;IIILorg/apache/zookeeper/server/ZKDatabase;)V
at org.apache.curator.test.TestingZooKeeperMain$TestZooKeeperServer.<init>(TestingZooKeeperMain.java:265)
at org.apache.curator.test.TestingZooKeeperMain.internalRunFromConfig(TestingZooKeeperMain.java:226)
at org.apache.curator.test.TestingZooKeeperMain.runFromConfig(TestingZooKeeperMain.java:132)
at org.apache.curator.test.TestingZooKeeperServer$1.run(TestingZooKeeperServer.java:158)
at java.lang.Thread.run(Thread.java:748)

最佳答案

我认为 Curator 目前仅与 Zookeeper 3.5.x 兼容。我试图用 3.6.0 运行它。因此,切换到 3.5.x 的问题为我解决了这个问题。

关于java - Apache Curator TestServer 创建抛出 java.lang.NoSuchMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61389209/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com