1

I have a Kafka server with SSL. When producing messages to it, error occurs:

2020-05-29 19:19:27.677 [kafka-producer-network-thread | producer-1] ERROR o.a.k.c.producer.internals.Sender - [Producer clientId=producer-1] Uncaught error in kafka producer I/O thread: 
java.lang.IllegalStateException: Duplicate key host:9091 (id: 1 rack: null)
    at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
    at java.util.HashMap.merge(HashMap.java:1254)
    at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)

I'm confused about "Duplicate key" it implies. My configuration in application.properties:

spring.kafka.bootstrap-servers=host:9091
spring.kafka.properties.security.protocol=SSL
spring.kafka.ssl.trust-store-password=kafka
spring.kafka.properties.ssl.endpoint.identification.algorithm=
spring.kafka.ssl.key-store-password=abc
spring.kafka.ssl.trust-store-location=file:/path/client.truststore.jks
spring.kafka.ssl.key-store-location=file:/path/client.keystore.jks

Part configuration of Kafka producer from logs during runtime:

    acks = 1
    bootstrap.servers = [host:9091]
    client.dns.lookup = default
    client.id = 
    enable.idempotence = false
    interceptor.classes = []
    key.serializer = class org.apache.kafka.common.serialization.StringSerializer
    linger.ms = 0
    partitioner.class = class org.apache.kafka.clients.producer.internals.DefaultPartitioner
    security.protocol = SSL
    ssl.cipher.suites = null
    ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
    ssl.endpoint.identification.algorithm = 
    ssl.key.password = null
    ssl.keymanager.algorithm = SunX509
    ssl.keystore.location = /path/client.keystore.jks
    ssl.keystore.password = [hidden]
    ssl.keystore.type = JKS
    ssl.protocol = TLS
    ssl.provider = null
    ssl.secure.random.implementation = null
    ssl.trustmanager.algorithm = PKIX
    ssl.truststore.location = /path/client.truststore.jks
    ssl.truststore.password = [hidden]
    ssl.truststore.type = JKS
    transactional.id = null
    value.serializer = class org.apache.kafka.common.serialization.StringSerializer

Is there anything wrong? Any help will be appreciated.

It comes to me that versions may be incompatible according to the table in this document. Versions of mine:

spring-boot: 2.2.6.RELEASE
spring-kafka: 2.3.7.RELEASE
Kafka server: 0.10.1.1

However, I was able to successfully produce and consume from Kafka server (0.10.0.0) without SSL by utilizing the current version.

cosimoth
  • 167
  • 10

0 Answers0