2014-01-21 66 views
0

我只是坐在這裏試圖將我的應用部署到最近4小時的heroku。rake在推送到heroku時中止不接受TCP/IP連接

我只是想推進我的更改,但每次推送我的更改時都會顯示以下內容。

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.4ruby 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)' 
+0

好吧,請按照錯誤消息的建議。 「檢查主機名和端口是否正確,並且postmaster正在接受TCP/IP連接。」從'psql -h the_hostname -p the_port -U myusername the_databasename'開始。 –

+0

謝謝您的評論!我可以設置這些設置嗎?我以爲我只是需要一個git push來開始部署,而heroku會處理背景中的所有內容...... – pmuens

+0

哦,當在Heroku上推送並運行時,錯誤發生在本地。在那種情況下,沒關係。 –

回答

1

所以這一個真的很奇怪。

經過近一整天的調試,我才解決了這個問題。

它與jRuby沒有任何關係,也沒有與主動記錄適配器(如果使用ruby-Runtime而不是jruby-Runtime將其推送到heroku,會得到非常類似的錯誤)。

的問題,是由這條線在我的模型

validates_presence_of :terms_of_service

之一引起的註釋出來,按向Heroku的後再次一切都很好。

奇數...

0

你可以試試這個?

username: systemuser, host: localhost在YAML文件

如果上述解決方案不起作用,請參考以下鏈接:

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

希望這能解決您的問題!

+0

謝謝你的回答。不幸的是,這並沒有解決問題。我以爲Heroku會用自己的配置覆蓋database.yml-File ...... – pmuens