简体   繁体   English

使用激活器启动播放服务器引发application.conf找不到错误

[英]Starting play server with activator throw an application.conf not found error

I have a very strange problem. 我有一个很奇怪的问题。

I'm creating a server with play 2.3. 我正在使用play 2.3创建服务器。 when I launch it with activator run , it works perfectly. 当我使用activator run启动它时,它可以完美activator run But if I use activator start to launch the server in deployement mode, I'm getting an IOException: file not found for application.conf. 但是,如果我使用activator start以部署模式启动服务器,则会收到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]

When I run activator windows:packageBin it give me a warning about evicted library : 当我运行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

The strange thing is that it have been working few month ago... 奇怪的是,它已经在几个月前开始运作了...

Here is my build.sbt file : 这是我的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"
)

And my plugin.sbt file : 还有我的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")

EDIT : I have use the -Dconfig.file=conf/application.conf option to solve the previous exception, but I get a new one 编辑:我已经使用-Dconfig.file=conf/application.conf选项来解决先前的异常,但是我得到了一个新的异常

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

The problem you have is well known #499 , #554 and on play #4242 . 您遇到的问题是众所周知的#499#554播放中#4242

Playframework 2.3.x doesn't use AutoPlugins all the way through. Playframework 2.3.x并未完全使用AutoPlugins。 This causes strange issues when you mix AutoPlugins (sbt-native-packager 1.0.3) and non-AutoPlugin builds (like play 2.3.x). 当您混合使用AutoPlugins(sbt-native-packager 1.0.3)和非AutoPlugin构建(例如play 2.3.x)时,这会导致奇怪的问题。

Furthermore you are using the JavaAppPackaging archetype, but play already enables the JavaServerAppPackaging archetype. 此外,您正在使用JavaAppPackaging原型,但是已经启用了JavaServerAppPackaging原型。 This may also cause some strange behaviors like yours. 这也可能导致某些奇怪的行为,如您的行为。

So the solution would be 所以解决方案是

  • upgrade play 2.3.x to 2.4.x 将play 2.3.x升级到2.4.x
  • OR downgrade sbt-native-packager to 0.8.x 或将sbt-native-packager降级到0.8.x

You may also look at our docs for play 您也可以查看我们的文档进行游戏

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM