使用activator启动播放服务器会​​抛出application.conf not found错误

时间:2015-07-09 10:46:53

标签: java playframework sbt playframework-2.3 sbt-native-packager

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

我正在使用游戏2.3创建服务器。当我使用activator run启动它时,它完美无缺。但是,如果我使用activator start以deployement模式启动服务器,我会收到IOException:找不到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?)]

1 个答案:

答案 0 :(得分:2)

您遇到的问题众所周知#499#554play #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
  • OR将sbt-native-packager降级为0.8.x

您还可以查看our docs for play