I just returned to an old Play! framework project of mine which started in version 2.6.0
and has been updated to version 3.0.2
After fixing errors and updating the project to compile, I got it running! However when I hit localhost:9000
I immediately get a runtime error:
NoSuchMethodError: 'com.google.inject.Provider com.google.inject.util.Providers.guicify(javax.inject.Provider)'
play.api.inject.guice.GuiceableModuleConversions$$anon$4.$anonfun$configure$3(GuiceInjectorBuilder.scala:376)
scala.Option.foreach(Option.scala:437)
play.api.inject.guice.GuiceableModuleConversions$$anon$4.$anonfun$configure$2(GuiceInjectorBuilder.scala:375)
play.api.inject.guice.GuiceableModuleConversions$$anon$4.$anonfun$configure$2$adapted(GuiceInjectorBuilder.scala:372)
scala.collection.immutable.List.foreach(List.scala:334)
...
org.apache.pekko.stream.impl.fusing.MapAsyncUnordered$$anon$31.onPush(Ops.scala:1443)
...
org.apache.pekko.dispatch.Mailbox.exec(Mailbox.scala:253)
...
java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
I’ve banged my head on this for days now mostly doing things like:
- Updating / Changing the Scala version. Currently on
3.3.3
Clearing~/.ivy2
~/Library/Caches/Coursier/v1/https/repo1.maven.org
build.sbt
tweaks
Here is my build.sbt
name := """my-api"""
organization := "DEV LLC"
version := "1.0-SNAPSHOT"
scalaVersion := "3.3.3"
resolvers += "Typesafe Repository" at "https://mvnrepository.com/artifact/com.typesafe.akka/akka-stream"
libraryDependencies += filters
libraryDependencies += jdbc
libraryDependencies += ws
libraryDependencies += guice
// libraryDependencies += "com.google.inject" % "guice" % "4.2.0"
// libraryDependencies += "com.google.inject" % "guice" % "7.0.0"
libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.24"
libraryDependencies += "org.json4s" %% "json4s-native" % "4.0.7"
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "7.0.0" % "test"
libraryDependencies += "org.docx4j" % "docx4j-export-fo" % "3.3.0"
libraryDependencies += "org.jsoup" % "jsoup" % "1.9.2"
libraryDependencies += "com.github.nscala-time" %% "nscala-time" % "2.32.0"
libraryDependencies += "com.google.firebase" % "firebase-admin" % "5.9.0"
libraryDependencies += "net.codingwell" %% "scala-guice" % "7.0.0"
libraryDependencies += "org.apache.commons" % "commons-email" % "1.5"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
My theory has been that Play! is trying to call guicify
at runtime on a dynamically loaded object, and failing with NoSuchMethod
exception meaning that the version of Guice
I have installed must not be the right version.
If that theory is right, then I’m still left perplexed because I have verified that my installed Guice version is 7.0 ~/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/google/inject/guice/7.0.0
and the guicify
method was added in 4.x
Looking for any help or suggestions on how to move forward here as I am STUMPED!
xinu3 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.