簡體   English   中英

Kafka 測試容器未運行

[英]Kafka testcontainer not running

我正在嘗試為 debezium 集成設置集成測試環境(按照本示例中的說明進行操作),但測試容器(默認圖像:confluentinc/cp-kafka:5.2.1)未啟動但引發異常。

我使用下面提到的代碼來創建一個 KafkaContainer bean

    @Bean
    public KafkaContainer kafkaContainer() {
        if (kafkaContainer == null) {
            kafkaContainer = new KafkaContainer()
                    .withNetwork(network())
                    .withExternalZookeeper("172.17.0.2:2181");

                kafkaContainer.start();
           }
        }

        return kafkaContainer;
    }

它拋出以下異常。


***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.testcontainers.containers.KafkaContainer.getBootstrapServers(KafkaContainer.java:91)

The following method did not exist:

    org/testcontainers/containers/KafkaContainer.getHost()Ljava/lang/String;

The method's class, org.testcontainers.containers.KafkaContainer, is available from the following locations:

    jar:file:/home/shubham/.m2/repository/org/testcontainers/kafka/1.14.3/kafka-1.14.3.jar!/org/testcontainers/containers/KafkaContainer.class

The class hierarchy was loaded from the following locations:

    org.testcontainers.containers.KafkaContainer: file:/home/shubham/.m2/repository/org/testcontainers/kafka/1.14.3/kafka-1.14.3.jar
    org.testcontainers.containers.GenericContainer: file:/home/shubham/.m2/repository/org/testcontainers/testcontainers/1.12.5/testcontainers-1.12.5.jar
    org.testcontainers.containers.FailureDetectingExternalResource: file:/home/shubham/.m2/repository/org/testcontainers/testcontainers/1.12.5/testcontainers-1.12.5.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.testcontainers.containers.KafkaContainer

2020-09-10 01:09:49.937 ERROR 72507 --- [           main] o.s.test.context.TestContextManager      : Caught exception while allowing TestExecutionListener 

在 maven 依賴項中使用了舊版本的 org.testcontainers 並且它有效。 謝謝!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM