我已经为此斗争了几个小时,我不知道为什么在 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
我用手检查目标是否被清洁并再次构建。
"目标/开始:没有这样的文件或目录"指的是什么?到目标?到启动命令?别的什么?
Play 2.2 更改了用于启动应用的文件的名称和位置
http://www.playframework.com/documentation/2.2.x/Production
例如,要从项目文件夹启动项目"foo"的应用程序,请更新 Procfile 以运行:
target/universal/stage/bin/foo
请参阅部署到 Heroku,尤其是Connecting to a database
部分。
我按如下方式解决了它(可能已经回答了,但这是我的步骤)
$ heroku local web
在控制台中获得以下输出
forego | starting web.1 on port 5000
web.1 | /bin/bash: target/bin/Service: Permission denied
然后我做到了
$chmod 777 target/bin/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}