在Heroku上播放2.2应用程序崩溃 [英] Play 2.2 application crashes on Heroku

查看:129
本文介绍了在Heroku上播放2.2应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Play 2.0.4移到Play 2.2.0后,在Heroku上部署时出现此错误:

  10月15日13:23:12 heroku / web.1:用命令`target / universal / stage / bin / demagog -Dhttp.port = $ {PORT} $ {JAVA_OPTS} -Dconfig.resource = $ {DEMAGOG_ENVIRONMENT} .conf`启动进程
Oct 15 13:23:13 app / web.1:拾取JAVA_TOOL_OPTIONS:-Djava.net.preferIPv4Stack = true -Djava.rmi.server.useCodebaseOnly = true
Oct 15 13:23:13 app / web.1:错误的应用程序路径:-Xmx384m
Oct 15 13:23:15 heroku / web.1:状态从开始更改为崩溃
Oct 15 13:23:15 heroku / web。 1:进程退出状态为0
Oct 15 13:24:37 heroku / web.1:使用命令`target / universal / stage / bin / demagog -Dhttp.port = $ {PORT} -Dconfig启动进程。资源= $ {DEMAGOG_ENVIRONMENT} .conf`
10月15日13:24:37 app / web.1:拾取JAVA_TOOL_OPTIONS:-Djava.net.preferIPv4Stack = true -Djava.rmi.server.useCodebaseOnly = true
Oct 15 13:24:37 app / web.1:Play服务器进程ID是2
Oct 15 13: 24:37 app / web.1:糟糕,无法启动服务器。
10月15日13:24:37 app / web.1:java.lang.IllegalStateException:必须设置系统属性demagog.defaultUser。

我不明白这条讯息

 错误的应用程序路径:-Xmx384m 

第二个问题我可以请参阅我的Play应用程序无法找到系统属性'demagog.defaultUser',但此属性在JAVA_OPTS环境变量中设置。所以它应该工作。也许这只是上述问题的后果?任何提示?






已更新



JAVA_OPTS}作为@jan建议的Procfile。第一个错误

 错误的应用程序路径:-Xmx384m 

不在这里,但系统属性'demagog.defaultUser'仍未设置。

  Oct 16 10:50:35 heroku / web.1:使用命令`target / universal / stage / bin / demagog -Dhttp.port = $ {PORT} --Dconfig.resource = $ {DEMAGOG_ENVIRONMENT} .conf` 
Oct 16 10:50:35 app / web.1:拾取JAVA_TOOL_OPTIONS:-Djava.net.preferIPv4Stack = true -Djava.rmi.server.useCodebaseOnly = true
Oct 16 10: 50:35 app / web.1:播放服务器进程ID为2
Oct 16 10:50:35 app / web.1:糟糕,无法启动服务器。
10月16日10:50:35 app / web.1:java.lang.IllegalStateException:必须设置系统属性demagog.defaultUser。
...
Oct 16 10:50:35 app / web.1:at play.api.Play $ .start(Play.scala:87)
Oct 16 10:50: 35 app / web.1:在play.core.StaticApplication。< init>(ApplicationProvider.scala:52)
Oct 16 10:50:35 app / web.1:在play.core.server.NettyServer $ .createServer(NettyServer.scala:243)
Oct 16 10:50:35 app / web.1:在play.core.server.NettyServer $$ anonfun $ main $ 3.apply(NettyServer.scala:279)
Oct 16 10:50:35 app / web.1:在play.core.server.NettyServer $$ anonfun $ main $ 3.apply(NettyServer.scala:274)
Oct 16 10:50: 35 app / web.1:在scala.Option.map(Option.scala:145)
Oct 16 10:50:35 app / web.1:在play.core.server.NettyServer $ .main(NettyServer .scala:274)
Oct 16 10:50:35 app / web.1:在play.core.server.NettyServer.main(NettyServer.scala)
Oct 16 10:50:35 heroku / web.1:退出状态为255

当我运行heroku命令时

  heroku config 

我可以看到包含系统属性在JAVA_OPTS环境变量中

$ $ $ $ code> JAVA_OPTS:-Xmx384m -Xss512k -XX:+ UseCompressedOops -Ddemagog.defaultUser = xxx ...


解决方案

好的,我终于找到了。使用环境变量JAVA_OPTS设置我的系统属性的问题是:

lockquote

环境变量在Unix中区分大小写,而在Windows中不区分大小写。

结合由sbt-native-packager生成的脚本读取java_opts环境变量。所以你必须在Heroku中设置java_opts(小写)环境变量。


After moving from Play 2.0.4 to Play 2.2.0 I get this error when deploying on Heroku:

Oct 15 13:23:12 heroku/web.1: Starting process with command `target/universal/stage/bin/demagog -Dhttp.port=${PORT} ${JAVA_OPTS} -Dconfig.resource=${DEMAGOG_ENVIRONMENT}.conf`
Oct 15 13:23:13 app/web.1: Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true -Djava.rmi.server.useCodebaseOnly=true
Oct 15 13:23:13 app/web.1: Bad application path: -Xmx384m
Oct 15 13:23:15 heroku/web.1: State changed from starting to crashed
Oct 15 13:23:15 heroku/web.1: Process exited with status 0
Oct 15 13:24:37 heroku/web.1: Starting process with command `target/universal/stage/bin/demagog -Dhttp.port=${PORT} -Dconfig.resource=${DEMAGOG_ENVIRONMENT}.conf`
Oct 15 13:24:37 app/web.1: Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true -Djava.rmi.server.useCodebaseOnly=true
Oct 15 13:24:37 app/web.1: Play server process ID is 2
Oct 15 13:24:37 app/web.1: Oops, cannot start the server.
Oct 15 13:24:37 app/web.1: java.lang.IllegalStateException: System property demagog.defaultUser must be set. 

I don't understand this message

Bad application path: -Xmx384m

The second problem I can see is that my Play application can't found system property 'demagog.defaultUser', but this property is set in JAVA_OPTS environment variable. So it should work. Maybe it's just a consequence of the above problem? Any hints?


UPDATED

I have removed ${JAVA_OPTS} from the Procfile as @jan suggested. The first error

Bad application path: -Xmx384m

is not here anymore, but the system property 'demagog.defaultUser' is still not set.

Oct 16 10:50:35 heroku/web.1: Starting process with command `target/universal/stage/bin/demagog -Dhttp.port=${PORT} -Dconfig.resource=${DEMAGOG_ENVIRONMENT}.conf`
Oct 16 10:50:35 app/web.1: Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true -Djava.rmi.server.useCodebaseOnly=true
Oct 16 10:50:35 app/web.1: Play server process ID is 2
Oct 16 10:50:35 app/web.1: Oops, cannot start the server.
Oct 16 10:50:35 app/web.1: java.lang.IllegalStateException: System property demagog.defaultUser must be set.
...
Oct 16 10:50:35 app/web.1: at play.api.Play$.start(Play.scala:87)
Oct 16 10:50:35 app/web.1: at play.core.StaticApplication.<init>(ApplicationProvider.scala:52)
Oct 16 10:50:35 app/web.1: at play.core.server.NettyServer$.createServer(NettyServer.scala:243)
Oct 16 10:50:35 app/web.1: at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:279)
Oct 16 10:50:35 app/web.1: at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:274)
Oct 16 10:50:35 app/web.1: at scala.Option.map(Option.scala:145)
Oct 16 10:50:35 app/web.1: at play.core.server.NettyServer$.main(NettyServer.scala:274)
Oct 16 10:50:35 app/web.1: at play.core.server.NettyServer.main(NettyServer.scala)
Oct 16 10:50:35 heroku/web.1: Process exited with status 255 

when I run heroku command

heroku config

I can see the system property is included in the JAVA_OPTS environment variable

JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops -Ddemagog.defaultUser=xxx ...

解决方案

Ok, I finally found it. The problem with setting my system property using environment variable JAVA_OPTS is that:

Environment variables are case sensitive in Unix while case insensitive in Windows.

with combination that the script generated by the sbt-native-packager reads java_opts environment variable. So you have to set java_opts (lower case) environment variable within Heroku.

这篇关于在Heroku上播放2.2应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆