You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行Play服务器时遭遇NoSuchMethodError: scala.tools.nsc.Settings.bootclasspath()

Play服务器启动失败:NoSuchMethodError错误排查求助

错误信息

[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)

环境配置

  • 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

已尝试方案

  • 参考过Apple Silicon M1平台下Play框架故障相关的社区讨论方案

sbt插件配置

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)

恳请技术人员帮忙解决该问题。

内容的提问来源于stack exchange,提问作者aleks.n.fedorov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 18:32:25