在Heroku中部署后,Scala Play 2.2应用程序崩溃:target / start没有这样的文件或目录

时间:2013-09-30 01:27:48

标签: scala heroku deployment scala-2.10 playframework-2.2

我已经花了好几个小时与我斗争,我无法弄清楚为什么在Heroku中部署我的Scala Play 2.2应用程序之后我得到了这个堆栈跟踪:

2013-09-30T01:05:09.413177+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=18174 $PLAY_OPTS`
2013-09-30T01:05:10.931893+00:00 app[web.1]: bash: target/start: No such file or directory
2013-09-30T01:05:12.382399+00:00 heroku[web.1]: Process exited with status 127
2013-09-30T01:05:12.414050+00:00 heroku[web.1]: State changed from starting to crashed

我尝试了几个 Procfile 版本但没有成功,例如:

web: target/start -Dhttp.port=$PORT

web: target/start -Dhttp.port=$PORT $PLAY_OPTS

web: target/start -Dhttp.port=$PORT $JAVA_OPTS

web: target/start Web -Dhttp.port=$PORT $PLAY_OPTS

web: target/start -Dhttp.port=$PORT $PLAY_OPTS -Dconfig.file=application.conf

web: target/start -Dhttp.port=$PORT $PLAY_OPTS -Dconfig.file=conf/application.conf

我甚至尝试过不使用Procfile。

我正在使用Scala 2.10.2和Play 2.2。在同一个Heroku应用程序中,我在Play 2.0上运行了我的项目的先前版本,我不知道这是否相关。

该应用程序在本地运行良好。我连接到Heroku中的bash并运行

sbt clean
sbt stage

手动,我检查了目标是否被清理并再次构建。

“目标/开始:没有这样的文件或目录”是指什么?对目标?要启动命令?还有其他什么?

3 个答案:

答案 0 :(得分:21)

Play 2.2更改了用于启动应用程序的文件的名称和位置

http://www.playframework.com/documentation/2.2.x/Production

例如,要从项目文件夹启动项目'foo'的应用程序,请更新您的Procfile以运行:

target/universal/stage/bin/foo

答案 1 :(得分:2)

请参阅Deploy to Heroku,尤其是Connecting to a database部分。

答案 2 :(得分:2)

我解决了它如下(可能已经回答,但这是我的步骤)

$ heroku local web

在控制台中获得以下输出

forego | starting web.1 on port 5000
web.1  | /bin/bash: target/bin/Service: Permission denied

然后我做了

$chmod 777 target/bin/Service

并解决了问题。

这里,Service是我的应用程序的名称(在pom.xml org.codehaus.mojo插件中指定),这是我的Procfile文件内容的样子

web: target/bin/Service -Dhttp.port=${PORT} ${JAVA_OPTS} -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=${DATABASE_URL}