如何解决"连接被拒绝 - 连接(2)(Errno :: ECONNREFUSED)(Excon :: Errors :: SocketError)"?

时间:2014-05-10 18:23:51

标签: ruby-on-rails sockets neo4j excon

我无法启动Ruby on Rails应用程序了。 没有明显的原因,任何命令,如“rails s”,“rake db:migrate”,“thin start”等现在都会触发以下异常:

Connection refused - connect(2) (Errno::ECONNREFUSED) (Excon::Errors::SocketError)

经过一些阅读后,这似乎表明某个地方的某些东西没有听到某些端口(!)但不幸的是,这个地方我真的不了解和习惯。

我试图找出导致这种情况的原因时,我能想到的唯一一个变化就是在Macbook pro上运行Mavericks时安装和使用Jmeter和Homebrew。

任何能够指出我最终解决这个问题的正确方向的想法都将受到高度赞赏。

对于记录,以下是说明出错的地方:

编辑:这是完整的跟踪:

/Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/socket.rb:218:in `connect_nonblock': Connection refused - connect(2) (Errno::ECONNREFUSED) (Excon::Errors::SocketError)
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/socket.rb:218:in `rescue in block in connect'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/socket.rb:187:in `block in connect'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/socket.rb:183:in `each'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/socket.rb:183:in `connect'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/socket.rb:28:in `initialize'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/connection.rb:418:in `new'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/connection.rb:418:in `socket'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/connection.rb:126:in `request_call'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/newrelic_rpm-3.8.0.218/lib/new_relic/agent/instrumentation/excon/middleware.rb:28:in `request_call'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/middlewares/mock.rb:42:in `request_call'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/middlewares/instrumentor.rb:22:in `request_call'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/middlewares/base.rb:15:in `request_call'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/middlewares/base.rb:15:in `request_call'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/middlewares/base.rb:15:in `request_call'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/excon-0.33.0/lib/excon/connection.rb:269:in `request'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/neography-1.5.0/lib/neography/connection.rb:70:in `block (3 levels) in <class:Connection>'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/neography-1.5.0/lib/neography/connection.rb:84:in `log'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/neography-1.5.0/lib/neography/connection.rb:62:in `block (2 levels) in <class:Connection>'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/neography-1.5.0/lib/neography/rest/node_auto_indexes.rb:38:in `set_node_auto_index_status'
from /Users/pierre/argomento/config/initializers/01_neo4j.rb:20:in `<top (required)>'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `load'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `block in load'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `load'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/engine.rb:592:in `each'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/engine.rb:592:in `block in <class:Engine>'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/initializable.rb:30:in `run'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/initializable.rb:54:in `each'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/application.rb:136:in `initialize!'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/pierre/argomento/config/environment.rb:5:in `<top (required)>'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `require'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `require'
from /Users/pierre/argomento/config.ru:3:in `block in <main>'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /Users/pierre/argomento/config.ru:in `new'
from /Users/pierre/argomento/config.ru:in `<main>'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/commands/server.rb:46:in `app'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/commands/server.rb:70:in `start'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/commands.rb:50:in `tap'
from /Users/pierre/.rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.18/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

1 个答案:

答案 0 :(得分:3)

您是否检查过您的Neo4j服务器是否正在运行?

如果使用Homebrew安装它,可以通过发出以下命令来运行它:

neo4j start

然后您可以重试启动Rails应用程序:

rails s

来源:http://docs.neo4j.org/chunked/stable/server-installation.html

它解决了你的问题吗?