反馈 部署 Ruby China 后,无法打开首页,显示 404 页面。

kevinhua · 2012年03月23日 · 最后由 kevinhua 回复于 2012年03月23日 · 2929 次阅读

部署 Ruby China 后,无法打开首页,显示 404 页面。求解。

其它一切正常,后台管理,等等。

晚上回家去看一下日志。 另外,Ruby China 对 Gems 过度依赖呀,稍微调整一下 Gems 的版本 (小版本的调整),就不能正常运作。

访问其它所有功能都能返回 200OK,唯独/topics/以及/topics/:id/,浏览器会显示 404,日志中提示以下信息:

Started GET "/topics/2" for 127.0.0.1 at 2012-03-22 23:38:38 +0800
Processing by TopicsController#show as HTML
  Parameters: {"id"=>"2"}
  Rendered topics/_base.html.erb (1.0ms)
  Rendered topics/_topic_info.html.erb (1.0ms)
  Rendered topics/_replies.html.erb (0.2ms)
  Rendered topics/_editor_toolbar.html.erb (0.3ms)
  Rendered app/cells/topics/reply_help_block.zh-CN.html.erb (0.0ms)
  Rendered app/cells/topics/sidebar_for_new_topic_node.html.erb (0.6ms)
  Rendered topics/show.html.erb within layouts/application (53.2ms)
Completed 500 Internal Server Error in 63ms

ActionView::Template::Error (Connection refused - connect(2)):
    52:
    53: <div class="sidebar">
    54:     <%= render_cell :topics, :sidebar_for_new_topic_node, { :action => params[:action], :node => @node } %>
    55:     <%= render_cell :topics, :sidebar_for_more_like_this, { :topic => @topic} %>
    56: </div>
  app/cells/topics_cell.rb:48:in `sidebar_for_more_like_this'
  app/views/topics/show.html.erb:55:in `_app_views_topics_show_html_erb___4535444006796019447_42839120'

除此之年,看了一下系统日志,有时还会提示以下错误:


Started GET "/favicon.ico" for 127.0.0.1 at 2012-03-22 23:40:13 +0800

ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
  actionpack (3.2.2) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.2) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.2) lib/rails/rack/logger.rb:16:in `call'
  /home/kevin/.bundler/ruby/1.9.1/quiet_assets-b699ee6c8aac/lib/quiet_assets.rb:12:in `call_with_quiet_assets'
  actionpack (3.2.2) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.2) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/static.rb:61:in `call'
  rack-cache (1.1) lib/rack/cache/context.rb:132:in `forward'
  rack-cache (1.1) lib/rack/cache/context.rb:241:in `fetch'
  rack-cache (1.1) lib/rack/cache/context.rb:181:in `lookup'
  rack-cache (1.1) lib/rack/cache/context.rb:65:in `call!'
  rack-cache (1.1) lib/rack/cache/context.rb:50:in `call'
  railties (3.2.2) lib/rails/engine.rb:479:in `call'
  railties (3.2.2) lib/rails/application.rb:220:in `call'
  railties (3.2.2) lib/rails/railtie/configurable.rb:30:in `method_missing'
  passenger (3.0.11) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
  passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
  passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'

  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
  passenger (3.0.11) lib/phusion_passenger/utils.rb:479:in `safe_fork'
  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:180:in `start'
  passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
  <internal:prelude>:10:in `synchronize'
  passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
  passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
  passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
  passenger (3.0.11) helper-scripts/passenger-spawn-server:99:in `<main>'

bundle exec rake sunspot:solr:start

把搜索引擎启动

之前已经运行,但估计是因为sh:java: not found的原因。在 Ubuntu 下装 JDK 失败,求解:


DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from <top (required)> at /home/kevin/www-root/config/application.rb:13)
sh: java: not found
Removing stale PID file at /home/kevin/www-root/solr/pids/development/sunspot-solr-development.pid
Successfully started Solr ...

#5 楼 @Rei 求解,是不是因为sh: java: not found的原因呀

#7 楼 @kevinhua 奥,要装个 java 运行机。sunspot 是用 rubygems 包裹的 java 搜索引擎 (solr)

安装了 OpenJDK 后正常运行啦。

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