SBT Test Error: java.lang.NoSuchMethodError: net.jpountz.lz4.LZ4BlockInputStream
Kafka has a conflicting dependency with Spark and that's what caused this issue for me.
This is how you can exclude the dependency in you sbt file
lazy val excludeJpountz = ExclusionRule(organization = "net.jpountz.lz4", name = "lz4")
lazy val kafkaClients = "org.apache.kafka" % "kafka-clients" % userKafkaVersionHere excludeAll(excludeJpountz) // add more exclusions here
When you use this kafkaClients
dependency it would now exclude the problematic lz4 library.
Update:
This appears to be an issue with Kafka 0.11.x.x
and earlier version. As of 1.x.x
Kafka seems to have moved away from using the problematic net.jpountz.lz4
library. Therefore, using latest Kafka (1.x) with latest Spark (2.3.x) should not have this issue.
This artifact "net.jpountz.lz4:lz4" was moved to: "org.lz4 » lz4-java"
By using; libraryDependencies += "org.lz4" % "lz4-java" % "1.7.1", the issue has been resolved.