新手问题 Connection refused 难题!!

chaowyc · 2015年11月25日 · 最后由 msg7086 回复于 2015年11月26日 · 2466 次阅读

rails 新手,最近在练习rails开发,跟着guide做,遇到一个问题,现在有一个资源叫post ,当创建一个post时,报了一个特别奇怪的错误 Errno::ECONNREFUSED in PostsController#create

上google查了一下,确实发现了不少跟我一样的错误,这个错误是由于一个gem包sunspot导致的, 按照上图的指示执行 又出了下面错误 这就很奇怪,我今天是因为需要给每一个post加一个user的引用 如图 之后 才报了Connection refused 错误,之前一直没问题。真的不知道问题出在哪了,希望各位过来人能给予帮助

以下是 Framework Trace

rsolr (1.0.13) lib/rsolr/connection.rb:19:in `rescue in execute'
rsolr (1.0.13) lib/rsolr/connection.rb:14:in `execute'
rsolr (1.0.13) lib/rsolr/client.rb:182:in `execute'
rsolr (1.0.13) lib/rsolr/client.rb:176:in `send_and_receive'
sunspot_rails (2.2.0) lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
activesupport (3.2.16) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.16) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.16) lib/active_support/notifications.rb:123:in `instrument'
sunspot_rails (2.2.0) lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
rsolr (1.0.13) lib/rsolr/client.rb:82:in `update'
rsolr (1.0.13) lib/rsolr/client.rb:102:in `add'
sunspot (2.2.0) lib/sunspot/indexer.rb:106:in `add_documents'
sunspot (2.2.0) lib/sunspot/indexer.rb:29:in `add'
sunspot (2.2.0) lib/sunspot/session.rb:91:in `index'
sunspot (2.2.0) lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `index'
sunspot (2.2.0) lib/sunspot.rb:184:in `index'
sunspot_rails (2.2.0) lib/sunspot/rails/searchable.rb:392:in `solr_index'
sunspot_rails (2.2.0) lib/sunspot/rails/searchable.rb:492:in `perform_index_tasks'
activesupport (3.2.16) lib/active_support/callbacks.rb:457:in `_run__183924902__save__811899481__callbacks'
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.16) lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
activesupport (3.2.16) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.2.16) lib/active_record/callbacks.rb:264:in `create_or_update'
activerecord (3.2.16) lib/active_record/persistence.rb:84:in `save'
activerecord (3.2.16) lib/active_record/validations.rb:50:in `save'
activerecord (3.2.16) lib/active_record/attribute_methods/dirty.rb:22:in `save'
activerecord (3.2.16) lib/active_record/transactions.rb:259:in `block (2 levels) in save'
activerecord (3.2.16) lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
activerecord (3.2.16) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.2.16) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.2.16) lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
activerecord (3.2.16) lib/active_record/transactions.rb:259:in `block in save'
activerecord (3.2.16) lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
activerecord (3.2.16) lib/active_record/transactions.rb:258:in `save'
actionpack (3.2.16) lib/action_controller/metal/mime_responds.rb:270:in `call'
actionpack (3.2.16) lib/action_controller/metal/mime_responds.rb:270:in `retrieve_collector_from_mimes'
actionpack (3.2.16) lib/action_controller/metal/mime_responds.rb:194:in `respond_to'
actionpack (3.2.16) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.16) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.16) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.16) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.16) lib/active_support/callbacks.rb:414:in `_run__710052618__process_action__186697094__callbacks'
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.16) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.16) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.16) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.16) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.16) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.16) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.16) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.16) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.16) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.16) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.16) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.16) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.16) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.16) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.16) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.16) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.16) lib/action_dispatch/routing/route_set.rb:608:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.7) lib/rack/etag.rb:23:in `call'
rack (1.4.7) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.7) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.7) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.16) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.16) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `_run__425211498__call__811899481__callbacks'
activesupport (3.2.16) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.16) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.16) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.16) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.16) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.16) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.16) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.16) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.7) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.7) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.16) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.7) lib/rack/lock.rb:15:in `call'
actionpack (3.2.16) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.16) lib/rails/engine.rb:484:in `call'
railties (3.2.16) lib/rails/application.rb:231:in `call'
rack (1.4.7) lib/rack/content_length.rb:14:in `call'
railties (3.2.16) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.7) lib/rack/handler/webrick.rb:59:in `service'
/home/saasbook/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/home/saasbook/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/home/saasbook/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
共收到 4 条回复

日志不是已经告诉得很清楚了吗?你需要有 java 环境才能运行 solr

#1楼 @qhwa 但是我之前一直没有遇到需要Java环境的问题啊,本机之前一直没装Java环境,运行的好好的,就是昨晚改了点东西之后才出现这个问题,所以一直很纳闷。

运行的好好的,就是昨晚改了点东西之后才出现这个问题,所以一直很纳闷。

在这里找吧

跟着guide做?为什么guide要你用solr?

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册