从 Play 2.0.4 迁移到 Play 2.2.0 后,在 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.
我不明白这个消息
Bad application path: -Xmx384m
我可以看到的第二个问题是我的 Play 应用程序找不到系统属性 'demagog.defaultUser',但是这个属性是在 JAVA_OPTS 环境变量中设置的。所以它应该工作。也许这只是上述问题的结果?有什么提示吗?
更新
我已按照@jan 的建议从 Procfile 中删除了 ${JAVA_OPTS} 。第一个错误
Bad application path: -Xmx384m
不再在这里,但系统属性“demagog.defaultUser”仍未设置。
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
当我运行 heroku 命令时
heroku config
我可以看到系统属性包含在 JAVA_OPTS 环境变量中
JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops -Ddemagog.defaultUser=xxx ...