CloudKarafka / springboot-kafka-example

Apache Kafka example for Spring Boot
72 stars 71 forks source link

Cluster authorization failed. #5

Open DbIM opened 2 years ago

DbIM commented 2 years ago

Can't send message to topic (

app.properties spring.kafka.bootstrap-servers=rocket-01.srvs.cloudkafka.com:9094,rocket-02.srvs.cloudkafka.com:9094,rocket-03.srvs.cloudkafka.com:9094 spring.kafka.properties.security.protocol=SASL_SSL spring.kafka.properties.sasl.mechanism=SCRAM-SHA-256 spring.kafka.properties.sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule \ required username="login here" password="pass here"; cloudkarafka.topic=topic-default

2022-05-01 18:27:10.274 ERROR 1664 --- [ad | producer-1] o.a.k.clients.producer.internals.Sender : [Producer clientId=producer-1] Aborting producer batches due to fatal error

org.apache.kafka.common.errors.ClusterAuthorizationException: Cluster authorization failed.

caosDvlp commented 2 years ago

Hi! I'm having the same issue

ivangfr commented 2 years ago

Hi, I was facing the same problem.

Btw, I've this project spring-cloud-stream-kafka-multi-topics-cloudkarafka where I've implemented a pair producer / consumer using spring-kafka and another pair using spring-cloud-stream. Both can be used connecting to a CloudKarafka account or connecting to a Kafka-Zookeeper running locally in your machine.

Today, I've tried to upgrade my project, and I've faced with this ClusterAuthorizationException issue that only happens with the spring-kafka producer. Meanwhile, the spring-kafka consumer and the another spring-cloud-stream pair producer / consumer are working fine.

Researching around, I've found this

In short, if you are using spring-kafka and your spring-boot version is >= 2.6, in order to solve ClusterAuthorizationException issue, just set the following in your application.properties

spring.kafka.producer.properties.enable.idempotence=false
caosDvlp commented 2 years ago

Thank you so much! :D

I'll take a look!

On Thu, 9 Jun 2022 at 22:06, Ivan Franchin @.***> wrote:

Hi, I was facing the same problem.

Btw, I've this project spring-cloud-stream-kafka-multi-topics-cloudkarafka https://github.com/ivangfr/spring-cloud-stream-kafka-multi-topics-cloudkarafka where I've implemented a pair producer / consumer using spring-kafka and another pair using spring-cloud-stream. Both can be used connecting to a CloudKarafka account or connecting to a Kafka-Zookeeper running locally in your machine.

Today, I've tried to upgrade my project, and I've faced with this ClusterAuthorizationException issue that only happens with the spring-kafka producer. Meanwhile, the spring-kafka consumer and the another pair spring-cloud-stream producer / consumer using are working fine.

Researching around, I've found this https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.6-Release-Notes#kafka-30

In short, if you are using spring-kafka and your spring-boot version is

= 2.6, in order to solve ClusterAuthorizationException issue, just set the following in your application.properties

spring.kafka.producer.properties.enable.idempotence=false

— Reply to this email directly, view it on GitHub https://github.com/CloudKarafka/springboot-kafka-example/issues/5#issuecomment-1151568606, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUM5LPWF5WRIO475CXGAGYDVOJFFTANCNFSM5U2BUAOA . You are receiving this because you commented.Message ID: @.***>

YyuriD commented 3 months ago

Thank you very much!!!!!! I spent half a day on this...