ruby-on-railssocketsneo4jexcon

How to solve "Connection refused - connect(2) (Errno::ECONNREFUSED) (Excon::Errors::SocketError)"?


I cannot get my Ruby on Rails app to start anymore. For no apparent reason, any command such as "rails s", "rake db:migrate", "thin start", etc now triggers the following exception :

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

After some reading, this seems to indicate that something, somewhere, is not listening to some ports (!) but this is unfortunately an area I am really not knowledgeable and comfortable with.

The only recent change I can think of when trying to find out what could have caused this is the installation and use of Jmeter with Homebrew on my Macbook pro running Mavericks.

Any ideas that could point me to the right direction to eventually solve this would be highly appreciated.

For the record, here are the lines that tell where things go wrong :

EDIT : here is the complete trace :

/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>'

Solution

  • Did you check that your Neo4j server is running ?

    If you installed it using Homebrew, you can run it by issuing the following command:

    neo4j start
    

    Then you may retry to launch your Rails app:

    rails s
    

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

    Did it solve your problem ?