embeddedkafka / embedded-kafka

A library that provides an in-memory Kafka instance to run your tests against.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrading from 2.7.0 to 2.8.0 - NoSuchMethodError

mveeprojects opened this issue · comments

Since upgrading from 2.7.0 to 2.8.0 and having changed all imports from net.manub... to io.github... we have seen the below when trying to use withRunningKafka. Is there something else we also need to do to migrate from 2.7.0 to 2.8.0?

[error] java.lang.NoSuchMethodError: 'boolean kafka.server.KafkaServer$.$lessinit$greater$default$4()'
[error]         at io.github.embeddedkafka.ops.KafkaOps.startKafka(kafkaOps.scala:52)
[error]         at io.github.embeddedkafka.ops.KafkaOps.startKafka$(kafkaOps.scala:26)

Hi @mveeprojects,
can you tell me which Scala version are you using? Are you importing other libraries related to Kafka?

Hi @francescopellegrini - we're using Scala 2.13.5. We are yes, we have "kafka" and "kafka-streams" from "org.apache.kafka" imported as well.

Hi @francescopellegrini - we're using Scala 2.13.5. We are yes, we have "kafka" and "kafka-streams" from "org.apache.kafka" imported as well.

I've created a simple project with those 3 dependencies alone but I was not able to reproduce your error, unfortunately..

Are there any other dependencies which could cause conflicts? May I also ask you why are you importing kafka itself?

I've found the best way to deal with this to be adding addDependencyTreePlugin into the SBT project and looking at the tree to figure out what is pulling in the various transitive dependencies.

Sorry it's been a while, going to close this while we look into this. Thanks for your help.

For me the solution was to define dependencyOverrides

    dependencyOverrides ++= Seq(
      "org.apache.kafka" %% "kafka-clients" % embeddedKafkaVersion,
      "org.apache.kafka" %% "kafka" % embeddedKafkaVersion
    )
    ```