FYI - I just tried your code snippet and it works fine for me:

OS: MacOS X (latest)
JDK: openjdk version "1.7.0-ea"
ZooKeeper: 3.4.5

-JZ

On Jan 22, 2013, at 4:45 PM, Matthew Daumen <[email protected]> wrote:

> Folks,
> 
> I'm looking for a solution to creating an embedded zookeeper server for
> testing.  I was using Curator's TestingServer, but after Curator 1.2.3 it
> is broken and fails to allow me to authenticate.
> 
> I'm working from
> http://zookeeper.apache.org/doc/r3.4.5/zookeeperAdmin.html#sc_minimumConfiguration
> 
> So, I tried this out:
> 
>        Properties startupProperties = new Properties();
> 
>        startupProperties.put("clientPort", 33333);
>        startupProperties.put("dataDir", "/www/a/data/zookeeper/data");
>        startupProperties.put("tickTime", 2000);
> 
>        QuorumPeerConfig quorumConfiguration = new QuorumPeerConfig();
>        try {
>            quorumConfiguration.parseProperties(startupProperties);
>        } catch(Exception e) {
>            throw new RuntimeException(e);
>        }
> 
>        final ZooKeeperServerMain zooKeeperServer = new
> ZooKeeperServerMain();
>        final ServerConfig configuration = new ServerConfig();
>        configuration.readFrom(quorumConfiguration);
> 
>        new Thread() {
>            public void run() {
>                try {
>                    zooKeeperServer.runFromConfig(configuration);
>                } catch (IOException e) {
>                    log.error("ZooKeeper Failed", e);
>                }
>            }
>        }.start();
> 
>            try {
>                framework = CuratorFrameworkFactory.builder()
>                    .connectString("localhost:33333")
>                    .connectionTimeoutMs(60000)
>                    .retryPolicy(new RetryNTimes(5, 10000))
>                    .build();
>            } catch (Exception e) {
>                log.error("Error trying to instantiate ZK
> TestingServer...", e);
>            }
> 
>            framework.start();
> 
> 
> For some reason, when I try to connect to the server I've created using
> localhost:3333, I get the following:
> 
> 2013-01-22 16:19:40 | ERROR |  | Thread-13 |
> com.macys.stella.services.async.ZookeeperTestServer | ZooKeeper Failed
> java.io.IOException: Could not configure server because SASL configuration
> did not allow the  ZooKeeper server to authenticate itself properly:
> javax.security.auth.login.FailedLoginException: Password Incorrect/Password
> Required
> at
> org.apache.zookeeper.server.ServerCnxnFactory.configureSaslLogin(ServerCnxnFactory.java:205)
> at
> org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:87)
> at
> org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:110)
> at
> com.macys.stella.services.async.ZookeeperTestServer$1.run(ZookeeperTestServer.java:52)
> 2013-01-22 16:19:40 | INFO  |  | RMI TCP Connection(2)-127.0.0.1 |
> com.netflix.curator.framework.imps.CuratorFrameworkImpl | Starting
> 2013-01-22 16:19:40 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:40 | INFO  |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread |
> com.netflix.curator.framework.state.ConnectionStateManager | State change:
> CONNECTED
> 
> This is followed by a lot of log entries like this:
> 2013-01-22 16:19:43 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:44 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:45 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:46 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:47 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:48 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:49 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:50 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:51 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:52 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:54 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:55 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:56 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:57 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:58 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:19:59 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:00 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:01 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:02 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:03 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:05 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:06 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:07 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:08 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:09 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:10 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:11 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:12 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:13 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:15 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:16 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:17 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:18 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:19 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:20 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:21 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:22 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:23 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:24 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:26 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:27 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:28 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:29 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:30 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:31 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:32 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:33 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:34 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:35 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 2013-01-22 16:20:37 | ERROR |  | RMI TCP
> Connection(2)-127.0.0.1-EventThread | com.netflix.curator.ConnectionState |
> Authentication failed
> 
> So I'm confused.  If the above link to the zookeeper documentation truly
> represents a minimal configuration, suitable for running tests or for
> development scenarios, why is it that this config is not working for me?
> Why is SASL involved at all here?  I even set up using digest auth
> provider with super digest detailed in the docs and it never got that far,
> failing identically to what I've posted above.
> 
> I'm using Curator 1.3.0 so the version of Zookeeper in my project should be
> 3.4.5.  I have heard this is a bug in 3.4.4 that was fixed, but it appears
> the fix was incomplete.
> 
> Can someone help me out here? I just need an embedded zookeeper for testing
> and development scenarios, preferably without the need to maintain a config
> for it.
> 
> Thanks!
> 
> Matthew D.

Reply via email to