Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoSuchMethodError: play.api.Logger$.init(Ljava/io/File;Lscala/Enumeration$Value;)V

Tags:

scala

I am new to scala and sbt. After lot of investigations I have come up with below build.sbt. Am not able to find solution for this. It would be very helpful for me to proceed.

scalaVersion := "2.11.7"

scalaVersion in ThisBuild := "2.11.7"

val sparkVersion = "1.3.0"

val akkaVersion = "2.3.6"

libraryDependencies ++= Seq(
jdbc,
cache,
"com.typesafe.play" % "play_2.11" % "2.5.0-M2",
"org.slf4j" % "jcl-over-slf4j" % "1.7.18",
"org.slf4j" % "slf4j-simple" % "1.6.2",
"com.typesafe.akka" % "akka-actor_2.11" % "2.4.2",
"com.typesafe.akka" % "akka-slf4j_2.11" % "2.4.2",
"org.webjars" % "webjars-play_2.11" % "2.4.0-2",
"com.typesafe.play" % "play-ws_2.11" % "2.5.0-M2",
"org.webjars" % "bootstrap" % "3.2.0",
"org.webjars" % "html5shiv" % "3.7.0",
"org.webjars" % "respond" % "1.4.2",
"com.twitter" %% "algebird-core" % "0.9.0",                 // Twitter Algebird
"net.databinder.dispatch" % "dispatch-core_2.11" % "0.11.3",
"org.reactivemongo" % "play2-reactivemongo_2.11" % "0.11.10.play23",
"org.specs2" %% "specs2-core" % "3.6.5" % "test",
"org.specs2" %% "specs2-junit" % "3.6.5" % "test",
"org.specs2" %% "specs2-mock" % "3.6.5" % "test",
"org.mongodb" %% "casbah" % "2.8.1",                       // MongoDB Casbah
"com.sksamuel.elastic4s" %% "elastic4s" % "1.4.14"
)

Compilations is fine but getting runtime error, am not sure where is the error.

Error:

java.lang.NoSuchMethodError: play.api.Logger$.init(Ljava/io/File;Lscala/Enumeration$Value;)V
at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerStart.scala:88)
at play.core.server.DevServerStart$$anonfun$mainDev$1.apply(DevServerStart.scala:61)
at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:60)
at play.core.server.DevServerStart$.mainDevHttpMode(DevServerStart.scala:50)
at play.core.server.DevServerStart.mainDevHttpMode(DevServerStart.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 play.runsupport.Reloader$.startDevMode(Reloader.scala:223)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.devModeServer$lzycompute$1(PlayRun.scala:74)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.play$sbt$run$PlayRun$$anonfun$$anonfun$$anonfun$$devModeServer$1(PlayRun.scala:74)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:100)
at play.sbt.run.PlayRun$$anonfun$playRunTask$1$$anonfun$apply$2$$anonfun$apply$3.apply(PlayRun.scala:53)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) java.lang.reflect.InvocationTargetException
[error] Total time: 1 s, completed 7 Mar, 2016 8:05:59 PM
like image 775
user3317832 Avatar asked Mar 07 '16 15:03

user3317832


1 Answers

You cannot mix and match different Play versions.

ReactiveMongo "0.11.10.play23" actually needs Play 2.3. You tried to use the milestone 2 Play 2.5 development version.

The latest official Play version is 2.4.6 currently, so don't use a development milestone (M2) of Play 2.5 which is currently not yet finalized.

There's a matching ReactiveMongo version for Play 2.4. Use that.

Furthermore, when you want to develop a Play application, you should just use the (typesafe) lightbend "Activator" which generates a proper project template using the Play SBT plugin (which has proper template and routes compiliation support et cetera).

like image 177
cbley Avatar answered Oct 09 '22 15:10

cbley