SBT Test Error: java.lang.NoSuchMethodError: net.jpountz.lz4.LZ4BlockInputStream

前端 未结 2 1680
囚心锁ツ
囚心锁ツ 2020-12-14 20:06

Getting Below exception , when i tried to perform unit tests for my spark streaming code on SBT windows using scalatest.

sbt testOnly <>

相关标签:
2条回答
  • 2020-12-14 20:18

    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.

    0 讨论(0)
  • 2020-12-14 20:41

    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.

    0 讨论(0)
提交回复
热议问题