使用激活器启动播放服务器会抛出 application.conf 未找到错误
Starting play server with activator throw an application.conf not found error
我有一个很奇怪的问题。
我正在用 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 and on play #4242。
Playframework 2.3.x 没有一直使用 AutoPlugins。当您混合使用 AutoPlugins (sbt-native-packager 1.0.3) 和非 AutoPlugin 构建(如 play 2.3.x)时,这会导致奇怪的问题。
此外,您正在使用 JavaAppPackaging 原型,但 play 已经启用了 JavaServerAppPackaging 原型。这也可能会导致一些像你这样的奇怪行为。
所以解决方案是
- 升级游戏 2.3.x 到 2.4.x
- 或将 sbt-native-packager 降级为 0.8.x
你也可以看看our docs for play
我有一个很奇怪的问题。
我正在用 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 and on play #4242。
Playframework 2.3.x 没有一直使用 AutoPlugins。当您混合使用 AutoPlugins (sbt-native-packager 1.0.3) 和非 AutoPlugin 构建(如 play 2.3.x)时,这会导致奇怪的问题。
此外,您正在使用 JavaAppPackaging 原型,但 play 已经启用了 JavaServerAppPackaging 原型。这也可能会导致一些像你这样的奇怪行为。
所以解决方案是
- 升级游戏 2.3.x 到 2.4.x
- 或将 sbt-native-packager 降级为 0.8.x
你也可以看看our docs for play