2

I am trying to run a Spark 2.1 application on Cloudera cluster which does not yet support Spark 2.

I was following answers:

Which seem to be correct, however I get a strange error during spark-submit:

Exception in thread "main" java.lang.NoSuchMethodError: scala.runtime.IntRef.create(I)Lscala/runtime/IntRef;
    at scopt.OptionParser.parse(options.scala:370)
    at com.rxcorp.cesespoke.config.WasherConfig$.parse(WasherConfig.scala:22)
    at com.rxcorp.cesespoke.Process$.main(Process.scala:27)
    at com.rxcorp.cesespoke.Process.main(Process.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:729)
    at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
    at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
    at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
    at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

Using Denis Makarenko answer hint I have added:

spark-submit \
  ...
  --conf 'spark.executor.extraJavaOptions=-verbose:class' \
  --conf 'spark.driver.extraJavaOptions=-verbose:class' \
  ...

Just to see that, as said in the answer - we are running on the wrong classpath here! Checking the logs, I could clearly find:

[Loaded scala.runtime.IntRef from file:/opt/cloudera/parcels/CDH-5.8.4-1.cdh5.8.4.p0.5/jars/spark-assembly-1.6.0-cdh5.8.4-hadoop2.6.0-cdh5.8.4.jar]

Which is obviously the source of the problem.

After carefully checking the given posts from the beginning:

You should use spark-submit from the newer Spark installation (I'd suggest using the latest and greatest 2.1.1 as of this writing) and bundle all Spark jars as part of your Spark application.

So this is how I will follow!

I also recommend on reading: http://www.mostlymaths.net/2017/05/shading-dependencies-with-sbt-assembly.html

Atais
  • 10,857
  • 6
  • 71
  • 111

1 Answers1

4

Exception in thread "main" java.lang.NoSuchMethodError: scala.runtime.IntRef.create(I)Lscala/runtime/IntRef;

NoSuchMethodError often indicates a jar version mismatch. Since the missing method is in the scala.runtime package, most likely the problem is caused by compiling the code with one version of Scala, say 2.11, and running it with another one (2.10).

Check the Scala version in your build.sbt (scalaVersion := ...) and run JVM with -verbose:class parameter to make sure these Scala versions match.

Denis Makarenko
  • 2,853
  • 15
  • 29