Skip to content

Could not start embedded-kafka container #756

@AnatoliyYakimov

Description

@AnatoliyYakimov

Hello!
Im using embedded-kafka version 2.0.16, Spring Boot 2.3.3.RELEASE and Spring Cloud Hoxton.SR11
My embedded-kafka container gets stuck and test exits with healthcheck timeout error.
Meanwhile Kafka container produces this exception:

[2021-12-02 07:13:25,450] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalArgumentException: requirement failed: inter.broker.listener.name must be a listener name defined in advertised.listeners. The valid options based on currently configured listeners are BROKER
	at scala.Predef$.require(Predef.scala:338)
	at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:1933)
	at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1896)
	at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1389)
	at kafka.Kafka$.buildServer(Kafka.scala:67)
	at kafka.Kafka$.main(Kafka.scala:87)
	at kafka.Kafka.main(Kafka.scala)

My bootstrap.yml is:

embedded:
  kafka:
    enabled: true
    docker-image-version: 6.2.0
    wait-timeout-in-seconds: 320

Than i tried to fix this problem by adding appropriate env cpnfiguration as Kafka said:

embedded:
  kafka:
    env:
      KAFKA_INTER_BROKER_LISTENER_NAME: BROKER

But it still doesn't work: kafka cluster seems to be OK, but Healthchecks still not passing through no matter how big your timeout is.
Kafka container stuck with this logs:

[2021-12-02 07:21:28,640] INFO [KafkaServer id=1001] started (kafka.server.KafkaServer)
[2021-12-02 07:21:28,657] TRACE [Controller id=1001 epoch=1] Received response UpdateMetadataResponseData(errorCode=0) for request UPDATE_METADATA with correlation id 0 sent to broker tc-t2pKc5ZE:9092 (id: 1001 rack: null) (state.change.logger)
[2021-12-02 07:21:28,743] INFO [broker-1001-to-controller-send-thread]: Recorded new controller, from now on will use broker tc-t2pKc5ZE:9092 (id: 1001 rack: null) (kafka.server.BrokerToControllerRequestThread)
[2021-12-02 07:21:33,590] INFO [Controller id=1001] Processing automatic preferred replica leader election (kafka.controller.KafkaController)
[2021-12-02 07:21:33,591] TRACE [Controller id=1001] Checking need to trigger auto leader balancing (kafka.controller.KafkaController)

No ERROR logs were found in kafka container log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions