tototoshi/scala-csv

java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V

irenkamalova opened this issue · 11 comments

import java.io.File

import com.github.tototoshi.csv.CSVWriter

object ExApp extends App {
  val f = new File("out.csv")

  val writer = CSVWriter.open(f)

  writer.writeAll(List(List("a", "b", "c"), List("d", "e", "f")))

  writer.close()

}
Exception in thread "main" java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V
	at com.github.tototoshi.csv.QUOTE_MINIMAL$.<init>(Quoting.scala:20)
	at com.github.tototoshi.csv.QUOTE_MINIMAL$.<clinit>(Quoting.scala)
	at com.github.tototoshi.csv.DefaultCSVFormat.$init$(Formats.scala:28)
	at com.github.tototoshi.csv.package$$anon$1.<init>(package.scala:21)
	at com.github.tototoshi.csv.package$.<init>(package.scala:21)
	at com.github.tototoshi.csv.package$.<clinit>(package.scala)
	at com.kamalova.experimentals.ExApp$.delayedEndpoint$com$kamalova$experimentals$ExApp$1(ExApp.scala:14)
	at com.kamalova.experimentals.ExApp$delayedInit$body.apply(ExApp.scala:7)
	at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
	at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
	at scala.App$$anonfun$main$1.apply(App.scala:76)
	at scala.App$$anonfun$main$1.apply(App.scala:76)
	at scala.collection.immutable.List.foreach(List.scala:381)
	at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
	at scala.App$class.main(App.scala:76)
	at com.kamalova.experimentals.ExApp$.main(ExApp.scala:7)
	at com.kamalova.experimentals.ExApp.main(ExApp.scala)

Used:

      <dependency>
            <groupId>com.github.tototoshi</groupId>
            <artifactId>scala-csv_2.12</artifactId>
            <version>1.3.4</version>
        </dependency>

With lower verions it works:

        <!-- https://mvnrepository.com/artifact/com.github.tototoshi/scala-csv -->
        <dependency>
            <groupId>com.github.tototoshi</groupId>
            <artifactId>scala-csv_2.11</artifactId>
            <version>1.2.2</version>
        </dependency>

Which version of scala do you use? (Scala 2.11 or Scala 2.12?)

I realized the solution) yes, it's about version of scala) (mine is 2.11) I'm sorry, I'm still new at scala, but I try to explore it :)

what version of scala is resolving the issue in your case ?

As I remember correctly, 2.12 was ok

thanks for the swift response .

谢谢你迅速的回应。

啥情况啊 我的没用scala2.12啊 只用了2.11 还是老报这个错误

谢谢你迅速的回应。

啥情况啊 我的没用scala2.12啊 只用了2.11 还是老报这个错误

maven dependency's scope provided

@prashantgupta1616
What is the solution for the issue. I am also facing the same issue and could not find the solution for it.

@sdshanawaz check compatibility with you Scala versions