java.lang.noclassdeffounderror:scala/collection/gentraversableonce at kafka.utils.testutils.tempdir(testutils.scala)

3okqufwl  于 2021-06-04  发布在  Kafka
关注(0)|答案(1)|浏览(572)

使用时 @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)

我使用的是springboot2.3.3.release
我的gradle看起来像

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")
sg3maiej

sg3maiej1#

该接口只存在于 kafka_2.12 罐。
似乎你有一个2.12 ...-test jar和瓶子 2.13 Kafkajar(这不是你的毕业生说的)。
是什么 gradle dependencies 你说呢?

相关问题