Java 使用activator启动播放服务器时抛出application.conf not found错误
我有一个很奇怪的问题 我正在用play 2.3创建一个服务器。当我使用Java 使用activator启动播放服务器时抛出application.conf not found错误,java,playframework,sbt,playframework-2.3,sbt-native-packager,Java,Playframework,Sbt,Playframework 2.3,Sbt Native Packager,我有一个很奇怪的问题 我正在用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
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"
)
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")
和我的plugin.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"
)
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?)]
你的问题是众所周知的 PlayFramework2.3.x并没有一直使用自动插件。当您混合使用AutoPlugin(sbt native packager 1.0.3)和非AutoPlugin构建(如play 2.3.x)时,这会导致奇怪的问题 此外,您正在使用JavaAppPackaging原型,但play已经启用了JavaServerAppPackaging原型。这也可能导致一些像你这样的奇怪行为 所以解决办法是
- 将play 2.3.x升级到2.4.x
- 或将sbt本机打包机降级为0.8.x
您还可以查看如果您告诉activator像使用
-Dconfig.file=conf/application.conf
那样明确地使用此配置文件,会发生什么情况?@Kris编辑了这个问题,结果是我害怕这种问题。。。我无法升级到Play2.4,因为我没有Java8。。。我不知道你是否可以用sbt native packager 0.8制作windows installer?windows installer也可以用0.8.0制作。但是我不知道如何自定义配置文件?似乎无法导出添加的文件(证书)。文档可在此处找到: