Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Jackson 2.9.9 in java Spark

I am trying to use the MLLIB library (java) but one of my dependencies uses Jackson 2.9.9. I noticed that a pull request was made such that the master branch's dependency is upgraded to this particular version. Now I wanted to use this master branch so I cloned and installed this package using ./dev/make-distribution.sh. but not sure which jar packages to copy to my project. I tried to copy all the 3.0.0-snaphots but I end up with a class file for scala.Cloneable not found in my java program.

I also did a ./build/mvn -DskipTests install which installs the SNAPSHOT dependencies under ~/.m2.

I added them to the gradle build file

    // https://mvnrepository.com/artifact/org.apache.spark/spark-core
    compile group: 'org.apache.spark', name: 'spark-core_2.12', version: '3.0.0-SNAPSHOT'

    // https://mvnrepository.com/artifact/org.apache.spark/spark-mllib
    compile group: 'org.apache.spark', name: 'spark-mllib_2.12', version: '3.0.0-SNAPSHOT'

but upon execution under java 11, it complains about:

Exception in thread "main" java.lang.NoSuchFieldError: JAVA_9
    at org.apache.spark.storage.StorageUtils$.<init>(StorageUtils.scala:207)

Since java 9 is not available anymore I am wondering how to further debug this issue. I assume at least java 9 is required but the field does no longer exists?

like image 261
Jasper Avatar asked Aug 16 '19 06:08

Jasper


1 Answers

I notice that in the sourcecode StorageUtils.scala, it is pulling in apache common-lang3 for JAVA_9. Have you check whether apache common-lang3 is included in the classpath? It solved my problem by adding commons-lang3-3.9.jar to my classpath.

like image 111
alee Avatar answered Oct 05 '22 18:10

alee