推到Heroku时,Rake中止不接受TCP/IP连接



我只是坐在这里,试图将我的应用部署到Heroku过去4个小时。

我只想推动更改,但是每次我推动更改时都会出现以下内容。

rake aborted! The driver encountered an unknown error: org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

我正在运行使用jruby 1.7.4ruby 1.9.3rails 4.0.2应用程序。

我已经使用了此扩展名。https://devcenter.heroku.com/articles/labs-user-env-compile但这也不会有帮助。

这是一个更详细的堆栈跟踪

/tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-jdbc-adapter-1.3.5/lib/arjdbc/jdbc/connection.rb:23:in `initialize'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-jdbc-adapter-1.3.5/lib/arjdbc/jdbc/adapter.rb:68:in `initialize'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-jdbc-adapter-1.3.5/lib/arjdbc/postgresql/adapter.rb:1275:in `initialize'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-jdbc-adapter-1.3.5/lib/arjdbc/jdbc/connection_methods.rb:12:in `jdbc_connection'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-jdbc-adapter-1.3.5/lib/arjdbc/postgresql/connection_methods.rb:45:in `postgresql_connection'
       org/jruby/RubyBasicObject.java:1709:in `__send__'
       org/jruby/RubyKernel.java:2213:in `send'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `checkout'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `connection'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/connection_handling.rb:79:in `retrieve_connection'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/connection_handling.rb:53:in `connection'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/model_schema.rb:203:in `table_exists?'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activerecord-4.0.2/lib/active_record/attribute_methods.rb:123:in `attribute_method?'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activemodel-4.0.2/lib/active_model/validations/acceptance.rb:16:in `setup'
       org/jruby/RubyArray.java:2651:in `reject!'
       org/jruby/RubyArray.java:2614:in `reject'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activemodel-4.0.2/lib/active_model/validations/acceptance.rb:16:in `setup'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activemodel-4.0.2/lib/active_model/validations/with.rb:88:in `validates_with'
       org/jruby/RubyArray.java:1617:in `each'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activemodel-4.0.2/lib/active_model/validations/with.rb:86:in `validates_with'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/vendor/bundle/jruby/1.9/gems/activemodel-4.0.2/lib/active_model/validations/acceptance.rb:51:in `validates_acceptance_of'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/app/models/user.rb:20:in `User'
       /tmp/build_f358186b-fb40-492f-93f9-f05fa7b3f751/app/models/user.rb:1:in `(root)'

所以这个真的很奇怪。

经过近一天的调试,我能够解决这个问题。

它与Jruby无关,也与Active Record适配器无关(如果您将其推到ruby-runtime而不是jruby-runtime时,您会遇到非常相似的错误)。

问题是由我的一种模型之一

引起的

validates_presence_of :terms_of_service

在评论并将其推到Heroku之后,一切都很好。

奇数...

您可以尝试吗?

在您的yaml文件中设置username: systemuser, host: localhost

如果上述解决方案不起作用,请参阅此链接:

http://www.revsys.com/writings/postgresql/errors.html

希望这能解决您的问题!

相关内容

  • 没有找到相关文章

最新更新