gpt4 book ai didi

scala - 运行服务器后 Play 应用意外异常

转载 作者:行者123 更新时间:2023-12-04 17:39:11 28 4
gpt4 key购买 nike

我有一个用于简单 CRUD 操作的 scala play 应用程序。我能够运行这个应用程序并用它做了相当多的测试。然而,现在当我尝试运行该应用程序时,服务器已启动,但无法接受任何 http 请求并突然失败。

我尝试运行以下命令

clean
compile
update
reload

并且全部执行成功。当我使用 run 命令运行服务器时,我在控制台上得到了一个输出

[IJ][user-service] $ run

--- (Running the application, auto-reloading is enabled) ---

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

现在,只要我发出任何 http 请求(之前可以正常工作),我就会收到以下错误。

[error] application - 

! @7bag02h83 - Internal server error, for (GET) [/service/api/setup] ->

play.api.UnexpectedException: Unexpected exception[IllegalArgumentException: requirement failed: sourceMapper parameter is no longer supported by createContext; use create method's devContext parameter instead]
at play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:186)
at play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:124)
at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:202)
at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:117)
at akka.stream.impl.fusing.MapAsyncUnordered$$anon$31.onPush(Ops.scala:1318)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:519)
at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:482)
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:378)
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:588)
at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:472)
Caused by: java.lang.IllegalArgumentException: requirement failed: sourceMapper parameter is no longer supported by createContext; use create method's devContext parameter instead
at scala.Predef$.require(Predef.scala:277)
at play.api.ApplicationLoader$.createContext(ApplicationLoader.scala:187)
at play.core.server.DevServerStart$$anon$1.$anonfun$reload$3(DevServerStart.scala:172)
at play.utils.Threads$.withContextClassLoader(Threads.scala:22)
at play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:171)
at play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:124)
at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:202)
at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:117)
at akka.stream.impl.fusing.MapAsyncUnordered$$anon$31.onPush(Ops.scala:1318)
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:519)
[error] application

任何人都可以让我知道我在这里缺少什么吗?是否需要添加某种配置设置?

任何指针都会非常有帮助。提前致谢!!!

最佳答案

我恢复了对 build.sbt 文件的依赖,它现在似乎可以工作了。

当前的 build.sbt(正在运行)

libraryDependencies += guice
libraryDependencies += "com.typesafe.play" %% "play-slick" % "3.0.3"
libraryDependencies += "com.typesafe.play" %% "play-slick-evolutions" % "3.0.3"

libraryDependencies += "com.h2database" % "h2" % "1.4.196"

libraryDependencies += specs2 % Test

旧的 build.sbt(给我错误)

libraryDependencies ++= Seq(
guice,
ws,
"com.typesafe.play" %% "play-slick" % "4.0.0",
"com.typesafe.play" %% "play-slick-evolutions" % "4.0.0",
"com.h2database" % "h2" % "1.4.197",
specs2 % Test
)

我不知道它是如何重新开始工作的,但解决了我的问题。谢谢!!!

关于scala - 运行服务器后 Play 应用意外异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55322314/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com