I am trying to just run a TestingServer to be able to write unit tests for it.
val zkServer = new TestingServer(2182)
println(zkServer.getPort)
My pom has the following dependencies related to Curator, I have tried version 4.2.0 and 4.3.0, both throw the same error:
<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>
The Error thrown is this:
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)
I think Curator is only compatible with zookeeper 3.5.x right now. I was trying to run it with 3.6.0. Hence the problem switching to 3.5.x fixed the issue for me.