当我试图运行我的项目时,我会遇到这个错误。
线程"main“java.lang.NoSuchMethodError: java.lang.NoSuchMethodError中的异常
试图清除ivy2缓存,但没有成功。我的构建sbt是这样的:
scalaVersion := "2.11.7"
scalacOptions := Seq("-unchecked", "-feature", "-deprecation", "-encoding", "utf8")
resolvers ++= Seq(
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots"),
Resolver.bintrayRepo("websudos", "oss-releases"),
"spray repo" at "http://repo.spray.io",
"Typesafe repository snapshots" at "http://repo.typesafe.com/typesafe/snapshots/",
"Typesafe repository releases" at "http://repo.typesafe.com/typesafe/releases/",
"Sonatype repo" at "https://oss.sonatype.org/content/groups/scala-tools/",
"Sonatype releases" at "https://oss.sonatype.org/content/repositories/releases",
"Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Sonatype staging" at "http://oss.sonatype.org/content/repositories/staging",
"Sonatype" at "https://oss.sonatype.org/content/groups/public/",
"Java.net Maven2 Repository" at "http://download.java.net/maven/2/",
"Twitter Repository" at "http://maven.twttr.com"
)
libraryDependencies ++= {
val phantomV = "1.29.5"
val scalaTestV = "3.0.0"
val elastic4sV = "2.4.0"
val akkaStreamVersion = "2.4.2"
val akkaVersion = "2.3.11"
Seq(
"com.websudos" %% "phantom-dsl" % phantomV,
"com.websudos" %% "phantom-reactivestreams" % phantomV,
"com.websudos" %% "util-testing" % "0.13.0" % "test, provided",
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
"com.typesafe.akka" %% "akka-http-spray-json-experimental" % akkaStreamVersion,
"com.typesafe.akka" %% "akka-http-core" % akkaStreamVersion,
"com.typesafe.akka" %% "akka-http-experimental" % akkaStreamVersion,
"com.typesafe.akka" %% "akka-http-testkit" % akkaStreamVersion,
"org.scalatest" %% "scalatest" % scalaTestV % "test",
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
"com.typesafe.play" %% "play-streams-experimental" % "2.4.6",
"com.sksamuel.elastic4s" %% "elastic4s-core" % elastic4sV,
"com.sksamuel.elastic4s" %% "elastic4s-streams" % elastic4sV
)
}
lazy val root = project.in(file(".")).configs(IntegrationTest)
Defaults.itSettings
initialCommands := """|import akka.actor._
|import akka.pattern._
|import akka.util._
|import scala.concurrent._
|import scala.concurrent.duration._""".stripMargin
fork in run := true知道怎么解决吗?
更新: java.class.path显示
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/lib/tools.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jps-builders.jar:/Applications/IntelliJ IDEA.app/Contents/lib/util.jar:/Applications/IntelliJ IDEA.app/Contents/lib/trove4j.jar:/Users/avi/Library/Application Support/IntelliJIdea2016.2/Scala/lib/scala-library.jar:/Users/avi/Library/Application Support/IntelliJIdea2016.2/Scala/lib/scala-nailgun-runner.jar:/Users/avi/Library/Application Support/IntelliJIdea2016.2/Scala/lib/compiler-settings.jar:/Users/avi/Library/Application Support/IntelliJIdea2016.2/Scala/lib/jps/nailgun.jar:/Users/avi/Library/Application Support/IntelliJIdea2016.2/Scala/lib/jps/sbt-interface.jar:/Users/avi/Library/Application Support/IntelliJIdea2016.2/Scala/lib/jps/incremental-compiler.jar:/Users/avi/图书馆/应用Support/IntelliJIdea2016.2/Scala/lib/jps/scala-jps-plugin.jar:/Users/avi/Library/Application Support/IntelliJIdea2016.2/Scala/lib/jps/dotty-interfaces.jar
发布于 2016-11-15 14:08:34
听起来像是类路径问题。您可能正在使用调用(使用) Typesafe Config的库,但是在您的路径中Typesafe Config的版本小于1.3.0。未找到的方法是在Typesafe Config 1.3.0中介绍的。要查看运行时类路径,请确保这些语句是执行的第一条语句(即在应用程序崩溃之前):
val cp = System.getProperty("java.class.path")
val sep = System.getProperty("path.separator")
cp.split(sep).foreach(println)一旦您看到没有Typesafe Config 1.3.0,就将其添加为显式依赖项。
发布于 2016-11-15 14:19:29
将TypeSafe 1.3.1作为依赖项添加可能会有所帮助,将其作为依赖项的Seq()的一部分添加:
"com.typesafe" % "config" % "1.3.1"https://stackoverflow.com/questions/40610816
复制相似问题