Sindhu
Sindhu

Reputation: 2582

Scallop Verify() method with scala version `2.10.5` not working

I am using scalaVersion := "2.10.5" and libraryDependencies += "org.rogach" %% "scallop" % "3.1.2".

Getting following error: Exception in thread "main" java.lang.NoSuchMethodError: scala.collection.immutable.$colon$colon.hd$1()Ljava/lang/Object; at org.rogach.scallop.DefaultConverters$$anon$2.parse(DefaultConverters.scala:27) at org.rogach.scallop.ValueConverter$class.parseCached(ValueConverter.scala:21) at org.rogach.scallop.DefaultConverters$$anon$2.parseCached(DefaultConverters.scala:24) at org.rogach.scallop.Scallop$$anonfun$verify$17.apply(Scallop.scala:632) at org.rogach.scallop.Scallop$$anonfun$verify$17.apply(Scallop.scala:630) at scala.collection.immutable.List.foreach(List.scala:381) at org.rogach.scallop.Scallop.verify(Scallop.scala:630) at org.rogach.scallop.ScallopConfBase.verifyBuilder(ScallopConfBase.scala:405) at org.rogach.scallop.ScallopConfBase.verify(ScallopConfBase.scala:744) at com.unity3d.ads.conf.OperativeEventConverterConf.(OperativeEventConverterConf.scala:50) at com.unity3d.ads.analytics.TestClass$.main(TestClass.scala:51) at com.unity3d.ads.analytics.TestClass.main(TestClass.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:738) at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:187) at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:212) at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:126) at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

The exact same code is working fine with scalaVersion := "2.11.8"

Unfortunately, I have to use 2.10.5 because I am using spark version 1.6.

sample code:

`import org.rogach.scallop.{ScallopConf, ScallopOption, Serialization, ValueConverter, singleArgConverter}

class TestClass(args: Seq[String]) extends ScallopConf(args) with Serialization {

val testInput: ScallopOption[String] =
opt[String](
name = "test.input",
descr = "test",
required = false,
default = Option("testPath"))
verify()
}
`

Is there any workaround I can use here to make it work with scala 2.10.5?

Upvotes: 0

Views: 1337

Answers (1)

Sindhu
Sindhu

Reputation: 2582

Answering my question to in case someone else faces the similar issue.

This turned out to be the classpath issue. the root cause of the issue:

I was using spark 2.1 to run code compiled with spark 1.6 version. apparently, 1.6 uses scala 2.10.. while spark 2.1 uses scala 2.11...

Upvotes: 0

Related Questions