gpt4 book ai didi

java - 使用激活器启动 Play 服务器会​​抛出 application.conf not found 错误

转载 作者:行者123 更新时间:2023-11-30 03:21:08 29 4
gpt4 key购买 nike

我有一个非常奇怪的问题。

我正在使用 play 2.3 创建一个服务器。当我使用 activator run 启动它时,它工作得很好。但是,如果我使用 activator start 在部署模式下启动服务器,我会收到 IOException: file not found for application.conf。

Configuration error: Configuration error[application: application.conf: java.io.IOException: resource not found on classpath: application.conf, application.json: java.io.IOException: resource not found on classpath: application.json, application.properties: java.io.IOException: resource not found on classpath: application.properties]

当我运行 activator windows:packageBin 时,它会向我发出有关被逐出库的警告:

[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn] * com.typesafe.sbt:sbt-native-packager:0.7.4 -> 1.0.3
[warn] Run 'evicted' to see detailed eviction warnings

奇怪的是,几个月前它就一直在工作......

这是我的 build.sbt 文件:

name := """IdTabDriver"""
version := "1.0.0.1"

name in Windows := "IdTabDriver"

//packageSummary in Windows := "IdTabDriver"

//packageDescription in Windows := "IdTabDriver"

maintainer in Windows := "Access France"

organization := "Access France"

lazy val root = (project in file(".")).enablePlugins(PlayJava).enablePlugins(JavaAppPackaging)

scalaVersion := "2.11.1"

libraryDependencies ++= Seq(
cache,
javaWs,
"commons-configuration" % "commons-configuration" % "1.10",
"org.rxtx" % "rxtxcomm" % "2.0-7pre1"
)

还有我的plugin.sbt 文件:

resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.8")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.3")

编辑:我使用了-Dconfig.file=conf/application.conf选项来解决之前的异常,但我得到了一个新的异常

Configuration error: Configuration error[Cannot initialize the custom Global object (controllers.Global) (perhaps it's a wrong reference?)]

最佳答案

您遇到的问题是众所周知的#499 , #554以及 play #4242

Playframework 2.3.x 并未自始至终使用 AutoPlugins。当您混合 AutoPlugins (sbt-native-packager 1.0.3) 和非 AutoPlugin 版本(如 play 2.3.x)时,这会导致奇怪的问题。

此外,您正在使用 JavaAppPackaging 原型(prototype),但游戏已经启用了 JavaServerAppPackaging 原型(prototype)。这也可能会导致一些像您一样的奇怪行为。

所以解决方案是

  • 将游戏 2.3.x 升级到 2.4.x
  • 或将 sbt-native-packager 降级至 0.8.x

您还可以查看our docs for play

关于java - 使用激活器启动 Play 服务器会​​抛出 application.conf not found 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31315176/

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