Skip to content
Advertisement

Scala No Method Found Exception

I am using getting the below line of error :

java.lang.NoSuchMethodError: 'scala.collection.immutable.ArraySeq scala.runtime.ScalaRunTime$.wrapRefArray(java.lang.Object[])'

My Pom :

      <!-- https://mvnrepository.com/artifact/org.apache.spark/spark-streaming-kafka-0-10 -->
    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-streaming-kafka-0-10_2.12</artifactId>
        <version>3.2.0</version>
    </dependency>

Any help regarding this ?

Advertisement

Answer

Check mvn dependency:tree.

All your Scala libs will be suffixed with the major Scala version:

[INFO] +- io.circe:circe-config_2.12:jar:0.6.1:compile <-- scala 2.12 lib
[INFO] |  +- com.typesafe:config:jar:1.3.3:compile
[INFO] |  - io.circe:circe-parser_2.12:jar:0.11.1:compile <-- scala 2.12 lib

All of them need to be the same major version otherwise you’ll get binary incompatible libs at runtime.

Your maven pom should have all Scala libs suffixed to the same version like this:

<artifactId>circe-config_2.12</artifactId>

and of course the Scala maven plugin aligned with the same version.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement