ZooKeeper newbie here, so probably simple 'pilot error', but yet I am
stuck so any help appreciated.

I am trying to stand up a zookeeper environment so I can check things
out.  I have an opensuse 11.2 virtual machine that I run the server in,
and then I try to write a java client to connect to it from an OSX
10.6.3 machine.  No matter what combination of v3.2.2 or v.3.3.1 I try
(e.g. both client and server running v3.2.2, v3.3.1, or mixed) I get an
error similar to the following:

Client side:

Exception in thread "main"
KeeperErrorCode = ConnectionLoss for /myapp
        at com.novell.lsg.zookeeperclient.App.run(App.java:32)
        at com.novell.lsg.zookeeperclient.App.main(App.java:50)

Server side:

 2010-05-20 07:59:31,517 - WARN 
[NIOServerCxn.Factory:2181:nioserverc...@518] - Exception causing close
of session 0x0 due to java.io.IOException: Read error
2010-05-20 07:59:31,518 - INFO 
[NIOServerCxn.Factory:2181:nioserverc...@857] - closing session:0x0
NIOServerCnxn: java.nio.channels.SocketChannel[connected
local=/ remote=/]

The server side error varies slightly depending on the versions in use
at the time, but its always related to problems reading the client
stream.  In this particular run, I have v3.2.2 running on both sides. 
Any help appreciated!

In case it matters, here is my client

package com.novell.lsg.zookeeperclient;

import java.util.List;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;

 * Hello world!
public class App implements Watcher {

    ZooKeeper zk;
    boolean dead = false;

    public App() throws Exception {
        zk = new ZooKeeper("", 0, this);

    private void getChildren() throws Exception {
        List<String> children = zk.getChildren("/", true);

        System.out.println("Current child list:");
        for (String child : children) {

    private void run() throws Exception {
        String znode = zk.create("/myapp", null, null,

        System.out.println("Created " + znode);

        try {
            synchronized (this) {
                while (!this.dead) {
        } catch (InterruptedException e) {


    public static void main(String[] args) throws Exception {
        new App().run();


    public void process(WatchedEvent event) {
        System.out.println("Event: " + event.getType().toString());

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to