title: Spring Kafka Producer not sending to Kafka 1.0.0 (Magic v1 does not support record headers)
body: <p>I am using this docker-compose setup for setting up Kafka locally: <a href="https://github.com/wurstmeister/kafka-docker/" rel="noreferrer">https://github.com/wurstmeister/kafka-docker/</a></p>
  
  <p><code>docker-compose up</code> works fine, creating topics via shell works fine.</p>
  
  <p>Now I try to connect to Kafka via <code>spring-kafka:2.1.0.RELEASE</code></p>
  
  <p>When starting up the Spring application it prints the correct version of Kafka: </p>
  
  <pre><code>o.a.kafka.common.utils.AppInfoParser     : Kafka version : 1.0.0
  o.a.kafka.common.utils.AppInfoParser     : Kafka commitId : aaa7af6d4a11b29d
  </code></pre>
  
  <p>I try to send a message like this</p>
  
  <pre><code>kafkaTemplate.send("test-topic", UUID.randomUUID().toString(), "test");
  </code></pre>
  
  <p>Sending on client side fails with </p>
  
  <pre><code>UnknownServerException: The server experienced an unexpected error when processing the request
  </code></pre>
  
  <p>In the server console I get the message <strong>Magic v1 does not support record headers</strong></p>
  
  <pre><code>Error when handling request {replica_id=-1,max_wait_time=100,min_bytes=1,max_bytes=2147483647,topics=[{topic=test-topic,partitions=[{partition=0,fetch_offset=39,max_bytes=1048576}]}]} (kafka.server.KafkaApis)
  java.lang.IllegalArgumentException: Magic v1 does not support record headers
  </code></pre>
  
  <p>Googling suggests a version conflict, but the version seem to fit (<code>org.apache.kafka:kafka-clients:1.0.0</code> is in the classpath).</p>
  
  <p>Any clues? Thanks!</p>
  
  <p>Edit:
  I narrowed down the source of the problem. Sending plain Strings works, but sending Json via JsonSerializer results in the given problem. Here is the content of my producer config: </p>
  
  <pre><code>@Value("\${kafka.bootstrap-servers}")
  lateinit var bootstrapServers: String
  
  @Bean
  fun producerConfigs(): Map&lt;String, Any&gt; =
          HashMap&lt;String, Any&gt;().apply {
              // list of host:port pairs used for establishing the initial connections to the Kakfa cluster
              put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers)
              put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer::class.java)
              put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer::class.java)
          }
  
  @Bean
  fun producerFactory(): ProducerFactory&lt;String, MyClass&gt; =
          DefaultKafkaProducerFactory(producerConfigs())
  
  @Bean
  fun kafkaTemplate(): KafkaTemplate&lt;String, MyClass&gt; =
          KafkaTemplate(producerFactory())
  </code></pre>