Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.io.EOFException when readData #48

Open
jackwoolley opened this issue Apr 17, 2016 · 2 comments
Open

java.io.EOFException when readData #48

jackwoolley opened this issue Apr 17, 2016 · 2 comments

Comments

@jackwoolley
Copy link

jackwoolley commented Apr 17, 2016

`
Exception in thread "main" org.I0Itec.zkclient.exception.ZkMarshallingError: java.io.EOFException

at org.I0Itec.zkclient.serialize.SerializableSerializer.deserialize(SerializableSerializer.java:37)

at org.I0Itec.zkclient.ZkClient.derializable(ZkClient.java:1071)

at org.I0Itec.zkclient.ZkClient.readData(ZkClient.java:1106)

at org.I0Itec.zkclient.ZkClient.readData(ZkClient.java:1094)

at test.gzu.select.zk.TestWriteToZK.main(TestWriteToZK.java:29)

Caused by: java.io.EOFException

at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2332)

at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2801)

at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:802)

at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)

at org.I0Itec.zkclient.serialize.TcclAwareObjectIputStream.<init>(TcclAwareObjectIputStream.java:30)

at org.I0Itec.zkclient.serialize.SerializableSerializer.deserialize(SerializableSerializer.java:31)

... 4 more

`

This my code:

`
public static void main(String[] args) {

    ZkClient zkClient = new ZkClient("127.0.0.1:2181", 5000);

    byte[] file = zkClient.readData("/MySQLLog");

    System.out.println(file);

}

`

This my zookeeper node data:
`
[zk: localhost:2181(CONNECTED) 95] get /MySQLLog

adf

cZxid = 0xee

ctime = Mon Apr 18 04:48:01 CST 2016

mZxid = 0xf8

mtime = Mon Apr 18 06:17:18 CST 2016

pZxid = 0xee

cversion = 0

dataVersion = 1

aclVersion = 0

ephemeralOwner = 0x0

dataLength = 3

numChildren = 0
`

@rasa-silva
Copy link

I can confirm this. Don't know how to reproduce though...
For my case, since the values are simple strings, I simply created a StringSerializer and setted that on the client instance...

@winniwang
Copy link

Meet the same problem.
For my case, also the values are simple strings, I created a ZkStringSerializer which implements ZkSerializer and setted that on the client instance.
public class ZkStringSerializer implements ZkSerializer{......}
val zkClient = new ZkClient(hostAndPort,10000,10000,new ZkStringSerializer())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants