Error reading field 'topic_metadata': Error reading array of size 1139567, only 45 bytes available
<p>--Consumer</p>

<pre><code>Properties props = new Properties();
        String groupId = "consumer-tutorial-group";
        List&lt;String&gt; topics = Arrays.asList("consumer-tutorial");
        props.put("bootstrap.servers", "192.168.1.75:9092");
        props.put("group.id", groupId);
        props.put("enable.auto.commit", "true");
        props.put("key.deserializer", StringDeserializer.class.getName());
        props.put("value.deserializer", StringDeserializer.class.getName());
        KafkaConsumer&lt;String, String&gt; consumer = new KafkaConsumer&lt;String, String&gt;(props);
        try {
            consumer.subscribe(topics);
            while (true) {

                ConsumerRecords&lt;String, String&gt; records = consumer.poll(Long.MAX_VALUE);
                for (ConsumerRecord&lt;String, String&gt; record : records)
                    System.out.printf("offset = %d, key = %s, value = %s", record.offset(), record.key(), record.value());


            }
        } catch (Exception e) {
            System.out.println(e.toString());
        } finally {
            consumer.close();
        }
    }
</code></pre>

<p>i am trying to write run the above code,its a simple consumer code which try to read from a topic but i got a weird exception and i can't handle it.</p>

<pre><code>org.apache.kafka.common.protocol.types.SchemaException: Error reading field 'topic_metadata': Error reading array of size 1139567, only 45 bytes available
</code></pre>

<p>i quote you also my producer code  </p>

<p>--Producer</p>

<pre><code>Properties props = new Properties();
        props.put("bootstrap.servers", "192.168.1.7:9092");
        props.put("acks", "all");
        props.put("retries", 0);
        props.put("batch.size", 16384);
        props.put("linger.ms", 1);
        props.put("buffer.memory", 33554432);
        props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
        props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");

        Producer&lt;String, String&gt; producer = new KafkaProducer&lt;String, String&gt;(props);
        for(int i = 0; i &lt; 100; i++)
            producer.send(new ProducerRecord&lt;String, String&gt;("consumer-tutorial", Integer.toString(i), Integer.toString(i)));

        producer.close();
</code></pre>

<p>Here is kafka configs</p>

<p><p>--Start zookeeper</p>

<p>bin/zookeeper-server-start.sh config/zookeeper.properties</p>

<p>--Start Kafka Server</p>

<p> bin/kafka-server-start.sh config/server.properties</p>

<p>-- Create a topic </p>

<p>bin/kafka-topics.sh --create --topic consumer-tutorial --replication-factor 1 --partitions 3 --zookeeper 192.168.1.75:2181</p>

<p>--Kafka 0.10.0</p>

<pre><code>&lt;dependency&gt;
           &lt;groupId&gt;org.apache.kafka&lt;/groupId&gt;
           &lt;artifactId&gt;kafka-clients&lt;/artifactId&gt;
           &lt;version&gt;0.10.0.0&lt;/version&gt;
   &lt;/dependency&gt;
   &lt;dependency&gt;
           &lt;groupId&gt;org.apache.kafka&lt;/groupId&gt;
           &lt;artifactId&gt;kafka_2.11&lt;/artifactId&gt;
           &lt;version&gt;0.10.0.0&lt;/version&gt;
   &lt;/dependency&gt;
</code></pre>