title: Exception on apache kafka - Error getting request for apikey: 3 and apiVersion: 2
body: <p>I am considerably new to Apache Kafka and Spring Kafka and am writing an application which consumes information from a topic and performs some operation.</p>
  
  <p>I wrote a simple consumer using @KafkaListener annotation and testing it against my local Kafka Server 0.10.1.1 and it worked all fine.</p>
  
  <p>Now when i am pointing to our DEV server of Kafka (version - 0.10.0.2.5) i see i get the below exception on the client side logs:</p>
  
  <pre><code>network.Selector - Connection with qm-alpha.activehealth.net/10.42.53.152 disconnected
  java.io.EOFException: null
      at org.apache.kafka.common.network.NetworkReceive.readFromReadableChannel(NetworkReceive.java:83) ~[kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.common.network.NetworkReceive.readFrom(NetworkReceive.java:71) ~[kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.common.network.KafkaChannel.receive(KafkaChannel.java:154) ~[kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.common.network.KafkaChannel.read(KafkaChannel.java:135) ~[kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:343) [kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.common.network.Selector.poll(Selector.java:291) [kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:260) [kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:232) [kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:180) [kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.ensureCoordinatorReady(AbstractCoordinator.java:193) [kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator.poll(ConsumerCoordinator.java:248) [kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.clients.consumer.KafkaConsumer.pollOnce(KafkaConsumer.java:1013) [kafka-clients-0.10.1.1.jar!/:?]
      at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:979) [kafka-clients-0.10.1.1.jar!/:?]
      at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:532) [spring-kafka-1.1.2.RELEASE.jar!/:?]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_121]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_121]
      at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
  </code></pre>
  
  <p>Also, i see the below errors on the server side logs:</p>
  
  <pre><code>kafka.network.InvalidRequestException: Error getting request for apiKey: 3 and apiVersion: 2
          at kafka.network.RequestChannel$Request.liftedTree2$1(RequestChannel.scala:95)
          at kafka.network.RequestChannel$Request.&lt;init&gt;(RequestChannel.scala:87)
          at kafka.network.Processor$$anonfun$processCompletedReceives$1.apply(SocketServer.scala:488)
          at kafka.network.Processor$$anonfun$processCompletedReceives$1.apply(SocketServer.scala:483)
          at scala.collection.Iterator$class.foreach(Iterator.scala:727)
          at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
          at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
          at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
          at kafka.network.Processor.processCompletedReceives(SocketServer.scala:483)
          at kafka.network.Processor.run(SocketServer.scala:413)
          at java.lang.Thread.run(Thread.java:745)
  Caused by: java.lang.IllegalArgumentException: Invalid version for API key 3: 2
          at org.apache.kafka.common.protocol.ProtoUtils.schemaFor(ProtoUtils.java:31)
          at org.apache.kafka.common.protocol.ProtoUtils.requestSchema(ProtoUtils.java:44)
          at org.apache.kafka.common.protocol.ProtoUtils.parseRequest(ProtoUtils.java:60)
          at org.apache.kafka.common.requests.MetadataRequest.parse(MetadataRequest.java:96)
          at org.apache.kafka.common.requests.AbstractRequest.getRequest(AbstractRequest.java:48)
          at kafka.network.RequestChannel$Request.liftedTree2$1(RequestChannel.scala:92)
  </code></pre>
  
  <p>I searched a few and found this is basically because of versioning problem between the client and the server, but could not find a way to resolve this.</p>