kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Koshy <jjkosh...@gmail.com>
Subject Re: StreamCorruptedException when running ZkUtils.getCluster(zKclient);
Date Fri, 05 Oct 2012 23:05:14 GMT
Hi David,

The zkclient needs a ZKSerializer: https://gist.github.com/3842975

Thanks,

Joel

On Fri, Oct 5, 2012 at 10:18 AM, David Harris <dharris@avum.com> wrote:

> I’m writing a simple java program to play around with the Kafka API and I’m
> running into an issue try to get the Cluster object.  The code is:
>
>
>
> ZkClient client = new ZkClient(KafkaProperties.zkConnect, 6000);
>
> Cluster cluster = ZkUtils.getCluster(client);
>
>
>
> But I’m getting the following error from the ZkUtils.getCluster(client)
> method when I try and run it:
>
> Exception in thread "main"
> org.I0Itec.zkclient.exception.ZkMarshallingError:
> java.io.StreamCorruptedException: invalid stream header: 3139322E
>
>                 at
>
> org.I0Itec.zkclient.serialize.SerializableSerializer.deserialize(SerializableSerializer.java:37)
>
>                 at
> org.I0Itec.zkclient.ZkClient.derializable(ZkClient.java:740)
>
>                 at org.I0Itec.zkclient.ZkClient.readData(ZkClient.java:773)
>
>                 at org.I0Itec.zkclient.ZkClient.readData(ZkClient.java:761)
>
>                 at org.I0Itec.zkclient.ZkClient.readData(ZkClient.java:750)
>
>                 at org.I0Itec.zkclient.ZkClient.readData(ZkClient.java:744)
>
>                 at kafka.utils.ZkUtils$.readData(ZkUtils.scala:162)
>
>                 at
> kafka.utils.ZkUtils$$anonfun$getCluster$1.apply(ZkUtils.scala:204)
>
>                 at
> kafka.utils.ZkUtils$$anonfun$getCluster$1.apply(ZkUtils.scala:203)
>
>                 at
> scala.collection.Iterator$class.foreach(Iterator.scala:631)
>
>                 at
>
> scala.collection.JavaConversions$JIteratorWrapper.foreach(JavaConversions.scala:474)
>
>                 at
> scala.collection.IterableLike$class.foreach(IterableLike.scala:79)
>
>                 at
>
> scala.collection.JavaConversions$JListWrapper.foreach(JavaConversions.scala:521)
>
>                 at kafka.utils.ZkUtils$.getCluster(ZkUtils.scala:203)
>
>                 at kafka.utils.ZkUtils.getCluster(ZkUtils.scala)
>
>                 at com.company.ClassName.main(ClassName.java:44)
>
> Caused by: java.io.StreamCorruptedException: invalid stream header:
> 3139322E
>
>                 at
> java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
>
>                 at
> java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
>
>                 at
>
> org.I0Itec.zkclient.serialize.SerializableSerializer.deserialize(SerializableSerializer.java:31)
>
>                 ... 15 more
>
>
>
> I’m not sure if I’m doing something wrong or misusing the API can anyone
> offer me any guidance?
>
>
> Thanks
> David Harris
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message