Hi, 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" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /myapp at org.apache.zookeeper.KeeperException.create(zookeeper:KeeperException.java):90) at org.apache.zookeeper.KeeperException.create(zookeeper:KeeperException.java):42) at org.apache.zookeeper.ZooKeeper.create(zookeeper:ZooKeeper.java):608) 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=/192.168.1.124:2181 remote=/192.168.1.141:50135] 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("192.168.1.124:2181", 0, this); } private void getChildren() throws Exception { List<String> children = zk.getChildren("/", true); System.out.println("Current child list:"); for (String child : children) { System.out.println(child); } } private void run() throws Exception { String znode = zk.create("/myapp", null, null, CreateMode.EPHEMERAL_SEQUENTIAL); System.out.println("Created " + znode); getChildren(); try { synchronized (this) { while (!this.dead) { wait(); } } } catch (InterruptedException e) { } System.out.println("Exiting"); } public static void main(String[] args) throws Exception { new App().run(); } public void process(WatchedEvent event) { System.out.println("Event: " + event.getType().toString()); } }
signature.asc
Description: OpenPGP digital signature