rake在推送到heroku时中止不接受TCP / IP连接

时间:2014-01-21 04:39:38

标签: ruby-on-rails postgresql heroku ruby-on-rails-4 jruby

我只是坐在这里尝试将我的应用程序部署到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.

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

我已经使用过此扩展程序了。 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)'

2 个答案:

答案 0 :(得分:2)

所以这个真的很奇怪。

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

它与jRuby无关,也与活动记录适配器无关(如果你用ruby-Runtime而不是jruby-Runtime将它推送到heroku,你会得到一个非常类似的错误。)

问题是由我的一个模型中的这一行引起的

validates_presence_of :terms_of_service

在评论出来并将其推送到heroku后,一切都很好。

...奇

答案 1 :(得分:0)

你能试试吗?

在YAML文件中设置username: systemuser, host: localhost

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

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

希望这能解决您的问题!