I am setting up Kafka on my local Windows 10 machine. So downloaded all the required binaries and updated the two settings server and zookeeper properties as per the documentation.
But when running the Kafka create topic command
kafka-topics.bat --create --bootstrap-server 127.0.0.1:2181 --replication-factor 1 --partitions 1 --topic testtopic
I am getting below error in the Zookeeper window
WARN Close of session 0x0 (org.apache.zookeeper.server.NIOServerCnxn)
java.io.IOException: Unreasonable length = 308375649
at org.apache.jute.BinaryInputArchive.checkLength(BinaryInputArchive.java:166)
at org.apache.jute.BinaryInputArchive.readBuffer(BinaryInputArchive.java:127)
at org.apache.zookeeper.proto.ConnectRequest.deserialize(ConnectRequest.java:91)
at org.apache.zookeeper.server.ZooKeeperServer.processConnectRequest(ZooKeeperServer.java:1350)
at org.apache.zookeeper.server.NIOServerCnxn.readConnectRequest(NIOServerCnxn.java:419)
at org.apache.zookeeper.server.NIOServerCnxn.readPayload(NIOServerCnxn.java:180)
at org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:339)
at org.apache.zookeeper.server.NIOServerCnxnFactory$IOWorkRequest.doWork(NIOServerCnxnFactory.java:522)
at org.apache.zookeeper.server.WorkerService$ScheduledWorkRequest.run(WorkerService.java:154)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Can somebody help me here?
I faced similar issue, because I was trying to connect to the zookeeper instance (Port 2181) while providing the --bootstrap-server option. Later, I provided the Kafka broker details (localhost:9092) & it worked fine.
In the older Kafka version, we used to provide --zookeeper option & hence its instance.
Try this command -
bin/kafka-topics.sh --create --topic testtopic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
The issue seems to be because of change between old Kafka/Zookeeper setup vs new one. In old one we were supposed to use --zookeeper option and port 2181 (by default); however with new Kafka/Zookeeper versions user is expected to use port 9092 by default with customer APIs. We get error java.io.IOException: Unreasonable length when API is issued using new Kafka with port 2181.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With