curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Boardman <boardmanjo...@gmail.com>
Subject Re: Mac, Java 1.8.0_05, PowerMock 1.6, Curator 2.7, Zookeeper 3.4.6, Kafka 0.8.2-beta, can't start embedded TestingServer for unit test
Date Thu, 11 Dec 2014 18:13:14 GMT
Thanks for the reply. Here's the log where ZK starts up. Interestingly, it
works perfectly in JDK 7.

12:12:13.638 [Thread-0] INFO  o.a.z.server.ZooKeeperServerMain - Starting
server

12:12:13.686 [Thread-0] INFO  o.a.zookeeper.server.ZooKeeperServer - Server
environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT

On Thu, Dec 11, 2014 at 12:09 PM, Jordan Zimmerman <
jordan@jordanzimmerman.com> wrote:

> Are you sure you’re getting ZooKeeper 3.4.6? It appears to be an
> incompatible version of the ZooKeeper client JAR.
>
> -JZ
>
>
> On December 11, 2014 at 12:22:16 PM, John Boardman (
> boardmanjohnw@gmail.com) wrote:
>
>  I am trying to use curator's embedded Zookeeper TestingServer to do my
> tests. Here is the simplest generic test class I could come up with that
> displays the error. Has anyone seen this?
> package com;
>
> import java.io.IOException;
> import java.util.Properties;
> import kafka.server.KafkaConfig;
> import kafka.server.KafkaServerStartable;
> import kafka.utils.TestUtils;
> import org.apache.curator.test.TestingServer;
> import org.junit.Test;
> import org.junit.runner.RunWith;
> import org.powermock.core.classloader.annotations.PowerMockIgnore;
> import org.powermock.modules.junit4.PowerMockRunner;
>
> @RunWith(PowerMockRunner.class)
> @PowerMockIgnore("javax.management.*")
> public class TestMe {
>     KafkaServerStartable kafkaServer;
>     TestingServer zkServer;
>
>     public TestMe() throws Exception {
>         zkServer = new TestingServer();
>         KafkaConfig config = getKafkaConfig(zkServer.getConnectString());
>         kafkaServer = new KafkaServerStartable(config);
>         kafkaServer.startup();
>     }
>
>     private static KafkaConfig getKafkaConfig(final String
> zkConnectString) {
>         scala.collection.Iterator<Properties> propsI =
> TestUtils.createBrokerConfigs(1, true).iterator();
>         assert propsI.hasNext();
>         Properties props = propsI.next();
>         assert props.containsKey("zookeeper.connect");
>         props.put("zookeeper.connect", zkConnectString);
>         return new KafkaConfig(props);
>     }
>
>     public String getKafkaBrokerString() {
>         return String.format("localhost:%d",
> kafkaServer.serverConfig().port());
>     }
>
>     public String getZkConnectString() {
>         return zkServer.getConnectString();
>     }
>
>     public int getKafkaPort() {
>         return kafkaServer.serverConfig().port();
>     }
>
>     public void stop() throws IOException {
>         kafkaServer.shutdown();
>         zkServer.stop();
>     }
>
>     @Test
>     public void test00() throws Exception {
>     }
> }
>
> The error I am getting is this:
>
> 10:29:50.374 [Thread-0] ERROR o.a.c.test.TestingZooKeeperServer - From
> testing server (random state: false) for instance:
> InstanceSpec{dataDirectory=/var/folders/51/7vtgpj8938j5snr6f49l3qzh0000gn/T/1418315390050-0,
> port=58985, electionPort=58986, quorumPort=58987,
> deleteDataDirectoryOnClose=true, serverId=1, tickTime=-1,
> maxClientCnxns=-1} org.apache.curator.test.InstanceSpec@e669
>
> java.lang.ClassCastException: class sun.security.provider.ConfigFile
>
> at java.lang.Class.asSubclass(Class.java:3293) ~[na:1.8.0_05]
>
> at javax.security.auth.login.Configuration$2.run(Configuration.java:254)
> ~[na:1.8.0_05]
>
> at javax.security.auth.login.Configuration$2.run(Configuration.java:247)
> ~[na:1.8.0_05]
>
> at java.security.AccessController.doPrivileged(Native Method)
> ~[na:1.8.0_05]
>
> at javax.security.auth.login.Configuration.getConfiguration(
> Configuration.java:246) ~[na:1.8.0_05]
>
> at org.apache.zookeeper.server.ServerCnxnFactory.configureSaslLogin(
> ServerCnxnFactory.java:174) ~[na:3.4.6-1569965]
>
> at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(
> NIOServerCnxnFactory.java:87) ~[na:3.4.6-1569965]
>
> at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(
> ZooKeeperServerMain.java:111) ~[na:3.4.6-1569965]
>
> at org.apache.curator.test.TestingZooKeeperMain.runFromConfig(
> TestingZooKeeperMain.java:73) ~[na:2.7.0]
>
> at org.apache.curator.test.TestingZooKeeperServer$1.run(
> TestingZooKeeperServer.java:148) ~[na:2.7.0]
>
>

Mime
View raw message