1

While using @EmbeddedKafka(topics = { "checkins" }) I am getting an error

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)

I am using spring boot 2.3.3.RELEASE

My gradle looks like

            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")
Rohit Naik
  • 501
  • 1
  • 4
  • 14

1 Answers1

2

That interface only exists in the kafka_2.12 jars.

It appears you somehow have a 2.12 ...-test jar and a 2.13 kafka jar (which is not what your gradle says).

What does gradle dependencies say?

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • You are correct there was 2.13 scala included by *group: 'io.findify', name: 's3mock_2.13* I had to downgrade it and it worked. – Rohit Naik Sep 10 '20 at 09:49