heroku中的应用程序错误(使用play框架)

时间:2012-04-30 06:52:12

标签: mongodb heroku playframework

我在java中使用play-1.2.4框架并使用MongoDB数据库。成功地在heroku repositary中推送项目。 并尝试打开我的页面,我仍然看到一个错误:应用程序错误

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

当我输入此heroku logs命令时,收到以下错误

heroku logs
   2012-05-05T06:00:13+00:00 app[web.1]: ~        _            _
2012-05-05T06:00:13+00:00 app[web.1]: ~  _ __ | | __ _ _  _| |
2012-05-05T06:00:13+00:00 app[web.1]: ~ |  __/|_|\____|\__ (_)
2012-05-05T06:00:13+00:00 app[web.1]: ~ | '_ \| |/ _' | || |_|
2012-05-05T06:00:13+00:00 app[web.1]: ~ |_|            |__/
2012-05-05T06:00:13+00:00 app[web.1]: ~
2012-05-05T06:00:13+00:00 app[web.1]: ~ play! 1.2.4, http://www.p
layframework.org
2012-05-05T06:00:13+00:00 app[web.1]: ~ framework ID is prod
2012-05-05T06:00:13+00:00 app[web.1]: ~ Ctrl+C to stop
2012-05-05T06:00:13+00:00 app[web.1]: ~
2012-05-05T06:00:13+00:00 app[web.1]: ~
2012-05-05T06:00:13+00:00 app[web.1]:
2012-05-05T06:00:14+00:00 heroku[web.1]: Process exited with stat
us 0
2012-05-05T06:00:14+00:00 heroku[web.1]: State changed from start
ing to crashed
2012-05-05T06:05:17+00:00 heroku[run.1]: State changed from creat
ed to starting
2012-05-05T06:05:19+00:00 app[run.1]: Awaiting client
2012-05-05T06:05:20+00:00 heroku[run.1]: State changed from start
ing to up
2012-05-05T06:05:49+00:00 app[run.1]: Error R13 (Attach error) ->
 Failed to attach to process
2012-05-05T06:05:50+00:00 heroku[run.1]: Process exited with stat
us 1
2012-05-05T06:05:50+00:00 heroku[run.1]: State changed from up to
 complete

当我使用heroku ps运行heroku进程时,它会向我显示

Process  State           Command
-------  --------------  ------------------------------------
web.1    crashed for 5m  play run --http.port=$PORT $PLAY_O..

当我运行heroku run console时,它会显示以下错误:

运行控制台连接到终端...

C:/Program Files/Heroku/l ib/heroku/client/rendezvous.rb:33:in `initialize': A connection a ttempt failed because the connected party did not properly respon d after a period of time, or established connection failed becaus e connected host has failed to respond. - connect(2) (Errno::ETIM EDOUT)
        from C:/Program Files/Heroku/lib/heroku/client/rendezvous .rb:33:in `open'
        from C:/Program Files/Heroku/lib/heroku/client/rendezvous .rb:33:in `block in start'
        from C:/Program Files/ruby-1.9.3/lib/ruby/1.9.1/timeout.r b:58:in `timeout'
        from C:/Program Files/Heroku/lib/heroku/client/rendezvous .rb:27:in `start'
        from C:/Program Files/Heroku/lib/heroku/command/run.rb:35 :in `index'
        from C:/Program Files/Heroku/lib/heroku/command.rb:148:in  `run'
        from C:/Program Files/Heroku/lib/heroku/cli.rb:9:in `star t'
        from C:/Program Files/Heroku/bin/heroku:28:in `<main>'

我错过了什么?任何人都可以帮我解决这个问题。

1 个答案:

答案 0 :(得分:2)

您需要在Heroku上以%prod模式运行Play。确保--%prod中有Procfile。以下是Procfile示例:

web:    play run -Xmx256M --%prod --http.port=$PORT -Dprecompiled=true