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

前端 未结 2 1681
囚心锁ツ
囚心锁ツ 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.

提交回复
热议问题