1

使用@EmbeddedKafka(topics = { "checkins" }) 时出现错误

Caused by: java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce
    at kafka.utils.TestUtils.tempDir(TestUtils.scala)
    at org.springframework.kafka.test.EmbeddedKafkaBroker$EmbeddedZookeeper.<init>(EmbeddedKafkaBroker.java:738)
    at org.springframework.kafka.test.EmbeddedKafkaBroker.afterPropertiesSet(EmbeddedKafkaBroker.java:291)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)

我正在使用弹簧靴 2.3.3.RELEASE

我的毕业典礼看起来像

            compile("io.confluent:kafka-json-serializer:$confluentJsonVersion")
            compile ("org.apache.kafka:kafka-clients: $kafkaVersion")
            implementation ("org.springframework.boot:spring-boot-starter-validation")
            implementation("org.springframework.kafka:spring-kafak:$springKafkaVersion")
            implementation "org.apache.kafka:kafka-clients:$kafkaVersion"

        testImplementation("org.springframework.kafka:spring-kafka-test:$springKafkaVersion")
        testImplementation("org.apache.kafka:kafka_2.13:$kafkaVersion")
        testImplementation("org.apache.kafka:kafka_2.13:$kafkaVersion:test")
        testImplementation ("org.apache.kafka:kafka-clients:$kafkaVersion:test")
4

1 回答 1

2

该接口仅存在于kafka_2.12罐子中。

看来您不知何故有一个 2.12 ...-testjar 和一个2.13kafka jar(这不是您的 gradle 所说的)。

说什么gradle dependencies

于 2020-09-09T14:39:15.510 回答