Runtime error "java.lang.NoSuchMethodError: scala.collection.Map$.apply(Lscala/collection/Seq;)Lscala/collection/GenMap" using Java API and built in eclipse

427 views
Skip to first unread message

angshu rai

unread,
Mar 28, 2013, 1:49:56 AM3/28/13
to spark...@googlegroups.com
Hi All,
I have set up a java project in eclipse and put in some sample code using spark java api, I have the necessary jar files in classpath and the code compiles as well (with some warnings). However while trying to execute the code from the exported jar (of the project) using command like: 
java -cp codes/SparkTest.jar sparktest.JavaSparkTest <args>

I am getting the following runtime error:
Exception in thread "main" java.lang.NoSuchMethodError: scala.collection.Map$.apply(Lscala/collection/Seq;)Lscala/collection/GenMap;
at spark.SparkContext.<init>(SparkContext.scala:83)
at spark.api.java.JavaSparkContext.<init>(JavaSparkContext.scala:28)
at sparktest.JavaSparkTest.main(JavaSparkTest.java:23)

I have spark-library.jar (version 2.9.2) as is used by sbt. I am running spark 0.6.1.

Can someone please point out what is it that I am missing out here?

Thanks a lot!
-Angshu

Patrick Wendell

unread,
Mar 29, 2013, 6:57:03 PM3/29/13
to spark...@googlegroups.com
You need to have Scala downloaded in the environment where you run
Spark and the Scala library also needs to be included in your
classpath.

If you look at the run script inside the spark/ folder, you'll see
some lines that do this:

CLASSPATH+=":$SCALA_LIBRARY_PATH/scala-library.jar"
CLASSPATH+=":$SCALA_LIBRARY_PATH/scala-compiler.jar"
CLASSPATH+=":$SCALA_LIBRARY_PATH/jline.jar"

This seems like maybe what is going on in your case.

- Patrick
> --
> You received this message because you are subscribed to the Google Groups
> "Spark Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to spark-users...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages