如何将Play Framework 2.4.4应用程序作为Windows服务运行?

时间:2015-12-02 10:04:00

标签: windows playframework

我试图按照

中描述的步骤进行操作

How do I run a Play Framework 2.0 application as a Windows service?

我在第5步失败了。 起初,该服务显示有关

的错误
  

play.core.server.NettyServer

脚本的一部分。 我把它改成了

  

play.core.server.ProdServerStart

但现在我在运行start.bat时遇到错误

C:\GCS>java -cp "C:\GCS\lib\*" play.core.server.ProdServerStart
Oops, cannot start the server.
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]
        at play.api.Configuration$.configError(Configuration.scala:178)
        at play.api.Configuration$.load(Configuration.scala:103)
        at play.api.Configuration$.load(Configuration.scala:133)
        at play.api.ApplicationLoader$.createContext(ApplicationLoader.scala:91)
        at play.core.server.ProdServerStart$.start(ProdServerStart.scala:50)
        at play.core.server.ProdServerStart$.main(ProdServerStart.scala:27)
        at play.core.server.ProdServerStart.main(ProdServerStart.scala)
Caused by: com.typesafe.config.ConfigException$IO: 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
        at com.typesafe.config.impl.SimpleIncluder.fromBasename(SimpleIncluder.java:236)
        at com.typesafe.config.impl.ConfigImpl.parseResourcesAnySyntax(ConfigImpl.java:132)
        at com.typesafe.config.ConfigFactory.parseResourcesAnySyntax(ConfigFactory.java:1024)
        at com.typesafe.config.ConfigFactory.parseApplicationConfig(ConfigFactory.java:238)
        at com.typesafe.config.ConfigFactory.defaultApplication(ConfigFactory.java:519)
        at play.api.Configuration$$anonfun$3.apply(Configuration.scala:75)
        at play.api.Configuration$$anonfun$3.apply(Configuration.scala:71)
        at scala.Option.getOrElse(Option.scala:121)
        at play.api.Configuration$.load(Configuration.scala:71)
        ... 5 more
Caused by: com.typesafe.config.ConfigException$IO: application.conf: java.io.IOException: resource not found on classpath: application.conf
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:188)
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:174)
        at com.typesafe.config.impl.Parseable.parse(Parseable.java:152)
        at com.typesafe.config.impl.SimpleIncluder.fromBasename(SimpleIncluder.java:185)
        ... 13 more
Caused by: java.io.IOException: resource not found on classpath: application.conf
        at com.typesafe.config.impl.Parseable$ParseableResources.rawParseValue(Parseable.java:735)
        at com.typesafe.config.impl.Parseable$ParseableResources.rawParseValue(Parseable.java:710)
        at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:180)
        ... 16 more

我到处寻找解决方案,但无法找到。

我猜自从给出原始答案以来,dist的构建方式发生了其他变化。

任何人都知道可能是什么问题?

1 个答案:

答案 0 :(得分:4)

您需要配置。在类路径上也是如此。根据你的conf的位置,尝试类似以下内容(未经测试):

java -cp ".conf;.;lib/*" play.core.server.ProdServerStart