Unable to run Play server, getting NoSuchMethodError
Error message:
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Enter to stop and go back to the console...)
[error] java.lang.NoSuchMethodError: 'scala.tools.nsc.settings.AbsSettings$AbsSetting scala.tools.nsc.Settings.bootclasspath()'
[error] at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$CompilerInstance.compiler$lzycompute(TwirlCompiler.scala:503)
[error] at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$CompilerInstance.compiler(TwirlCompiler.scala:481)
[error] at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$PresentationCompiler$.<init>(TwirlCompiler.scala:549)
[error] at play.twirl.compiler.TwirlCompiler$TemplateAsFunctionCompiler$PresentationCompiler$.<clinit>(TwirlCompiler.scala)
Configuration
- Apple M1 Monterey
- Scala 2.12.13
- sbt 1.6.1
- Play 2.7.9
- Java OpenJDK Runtime Environment Corretto-11.0.18.10.1
Already tried:
addSbtPlugin("se.marcuslonnberg" % "sbt-docker" % "1.8.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") // For passing build information.
addSbtPlugin("io.github.davidmweber" % "flyway-sbt" % "7.4.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.9")
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.2.13")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.1.0")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1")
lazy val insight = (project in file("insight"))
.enablePlugins(PlayScala, TypeSafeDockerPlugin, BuildInfoPlugin, BashStartScriptPlugin)
.settings(commonSettings)
.settings(baseBuildInfoKeys)
.settings(
Global / cancelable := false,
version := insightVersion,
resolvers += "shibboleth-release" at "https://build.shibboleth.net/nexus/content/repositories/releases", //for openSAML lib
libraryDependencies ++= insightDependencies,
libraryDependencies += scalaOrganization.value % "scala-compiler" % scalaVersion.value,
// automatically import template helpers for templates
TwirlKeys.templateImports ++= Seq(
"********.utils.Environment",
"********.models._",
"controllers._",
"templateHelpers._",
"org.joda.time.DateTime"
),
// disable js asset stuff, we manage it on our own
Assets / JsEngineKeys.npmNodeModules := Nil,
TestAssets / JsEngineKeys.npmNodeModules := Nil,
// don't produce docs
Compile / doc / sources := Seq.empty,
Compile / packageDoc / publishArtifact := false,
PlayKeys.playMonitoredFiles := {
val isUsingWebpackDevServer = Option(System.getenv("WEBPACK_DEV_SERVER_PORT")).isDefined
val filesList = PlayKeys.playMonitoredFiles.value
if (isUsingWebpackDevServer) {
(filesList --- baseDirectory.value / "public").get
} else {
filesList
}
},
// run webpack when doing dist as well for staging and production
webpackDistTask := {
val exitCode =
Process("node" :: "node_modules/webpack/bin/webpack.js" :: "--progress" :: "--colors" :: Nil, baseDirectory.value) !
if (exitCode != 0) {
// webpack build has an error
throw new RuntimeException(s"Webpack build error (exit code $exitCode). Check for errors above")
}
val versionRegex = "\\.([0-9a-f]*)\\.bundle".r
val version =
versionRegex.findFirstMatchIn(IO.readLines(baseDirectory.value / "conf" / "webpack-assets.json")(0)).get.group(1)
IO.write(baseDirectory.value / "conf" / "version.conf", s"webpack.version=$version".getBytes)
},
dist := (dist dependsOn webpackDistTask).value
)
.settings(commonDockerSettings)
.settings(dockerBuildInsight)
.dependsOn(knowledge)