Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mongodb heroku中的应用程序错误(使用play framework)_Mongodb_Heroku_Playframework - Fatal编程技术网

Mongodb heroku中的应用程序错误(使用play framework)

Mongodb heroku中的应用程序错误(使用play framework),mongodb,heroku,playframework,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

我在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运行控制台时,它显示以下错误:

正在运行的控制台连接到终端

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>'
C:/Program Files/Heroku/l ib/Heroku/client/rendezvous.rb:33:在“初始化”中:由于连接方在一段时间后没有正确响应,连接尝试失败,或者由于连接的主机没有响应而建立的连接失败。-连接(2)(错误号::ETIM EDOUT)
从C:/Program Files/Heroku/lib/Heroku/client/rendezvous.rb:33:in'open'
从C:/Program Files/Heroku/lib/Heroku/client/rendezvous.rb:33:in'block in start'
来自C:/ProgramFiles/ruby-1.9.3/lib/ruby/1.9.1/timeout.rb:58:in'timeout'
从C:/Program Files/Heroku/lib/Heroku/client/rendezvous.rb:27:in'start'
从C:/Program Files/Heroku/lib/Heroku/command/run.rb:35:in'index'
从C:/ProgramFiles/Heroku/lib/Heroku/command.rb:148:in'run'
从C:/Program Files/Heroku/lib/Heroku/cli.rb:9:in'star t'
从C:/ProgramFiles/Heroku/bin/Heroku:28:in`'

我错过了什么?谁能帮我解决这个问题。

你需要在Heroku上以
%prod
模式运行Play。确保您的
程序文件中有
-%prod
。下面是一个示例
Procfile

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

我的procfile包含这样一个“web:play run--http.port=$port$play_OPTS”,我运行“heroku日志”中的端口号和播放选项。问题是您正在开发模式下运行,而在开发模式下play在Java调试端口上侦听。在Heroku上,您的应用程序只能在一个端口上侦听,而您的应用程序正在尝试在两个端口上侦听。因此,您的
application.conf
可能以某种方式被设置为在prod mode.conf/application.conf文件中调试,而不是使用application.mode=dev,我写的是%production.application.mode=prod。但它仍然是您需要的:
%prod.application.mode=prod
以下是一个示例: