首次设置Phusion Passenger时出现数据库问题

时间:2010-05-10 14:17:09

标签: ruby-on-rails osx-snow-leopard passenger

我是一个新的ruby / rails用户试图通过现有的rails项目首次设置我的mac。使用mongrel时应用运行正常,但使用Phusion Passenger时无法正常启动。

问题似乎是在加载项目的第一个模型时。我猜测访问我的数据库有问题,但我不知道为什么。

我的杂种和乘客配置有所不同。可能rvm指的是错误的东西?也许我的宝石在某种程度上是不同的?也许我的mysql gem安装不正确?或者也许我的railsenv错了?我真的不知道,有什么想法吗?

您将在下面找到错误以及我的各种配置文件。

Expected /Users/mike/Projects/XXX/XXX/app/models/user/identity.rb to define User::Identity
0   /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  426 in `load_missing_constant'
1   /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  96  in `const_missing'
2   /Users/mike/Projects/XXX/XXX/app/models/user.rb 22  
3   /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  380 in `load_without_new_constant_marking'
4   /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  380 in `load_file'
5   /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  521 in `new_constants_in'
6   /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  379 in `load_file'
7   /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  259 in `require_or_load'
8   /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  425 in `load_missing_constant'
9   /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  80  in `rake_original_const_missing'
10  /Users/mike/Projects/XXX/XXX/vendor/gems/rake-0.8.7/lib/rake.rb 2503    in `const_missing'
11  /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  92  in `const_missing'
12  /Users/mike/Projects/XXX/XXX/spec/factories/point_allocation_factory.rb 1   
13  /Users/mike/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 31  in `gem_original_require'
14  /Users/mike/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 31  in `require'
15  /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  156 in `require'
16  /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  521 in `new_constants_in'
17  /Users/mike/Projects/XXX/XXX/vendor/rails/activesupport/lib/active_support/dependencies.rb  156 in `require'
18  /Users/mike/Projects/XXX/XXX/vendor/gems/factory_girl-1.2.3/lib/factory_girl/factory.rb 300 in `find_definitions'
19  /Users/mike/Projects/XXX/XXX/vendor/gems/factory_girl-1.2.3/lib/factory_girl/factory.rb 299 in `each'
20  /Users/mike/Projects/XXX/XXX/vendor/gems/factory_girl-1.2.3/lib/factory_girl/factory.rb 299 in `find_definitions'
21  /Users/mike/Projects/XXX/XXX/vendor/gems/factory_girl-1.2.3/lib/factory_girl/factory.rb 295 in `each'
22  /Users/mike/Projects/XXX/XXX/vendor/gems/factory_girl-1.2.3/lib/factory_girl/factory.rb 295 in `find_definitions'
23  /Users/mike/Projects/XXX/XXX/config/environments/development.rb 26  
24  /Users/mike/Projects/XXX/XXX/vendor/rails/railties/lib/initializer.rb   592 in `call'
25  /Users/mike/Projects/XXX/XXX/vendor/rails/railties/lib/initializer.rb   592 in `after_initialize'
26  /Users/mike/Projects/XXX/XXX/vendor/rails/railties/lib/initializer.rb   591 in `each'
27  /Users/mike/Projects/XXX/XXX/vendor/rails/railties/lib/initializer.rb   591 in `after_initialize'
28  /Users/mike/Projects/XXX/XXX/vendor/rails/railties/lib/initializer.rb   177 in `process'
29  /Users/mike/Projects/XXX/XXX/vendor/rails/railties/lib/initializer.rb   113 in `send'
30  /Users/mike/Projects/XXX/XXX/vendor/rails/railties/lib/initializer.rb   113 in `run'
31  /Users/mike/Projects/XXX/XXX/config/environment.rb  12  
32  /Users/mike/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 31  in `gem_original_require'
33  /Users/mike/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 31  in `require'
34  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/railz/application_spawner.rb    303 in `preload_application'
35  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/railz/application_spawner.rb    252 in `initialize_server'
36  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/utils.rb    255 in `report_app_init_status'
37  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/railz/application_spawner.rb    237 in `initialize_server'
38  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb  194 in `start_synchronously'
39  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb  163 in `start'
40  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/railz/application_spawner.rb    213 in `start'
41  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb    262 in `spawn_rails_application'
42  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server_collection.rb   126 in `lookup_or_add'
43  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb    256 in `spawn_rails_application'
44  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server_collection.rb   80  in `synchronize'
45  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server_collection.rb   79  in `synchronize'
46  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb    255 in `spawn_rails_application'
47  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb    154 in `spawn_application'
48  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/spawn_manager.rb    287 in `handle_spawn_application'
49  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb  352 in `__send__'
50  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb  352 in `main_loop'
51  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/lib/phusion_passenger/abstract_server.rb  196 in `start_synchronously'
52  /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/bin/passenger-spawn-server    61  

的.profile

if [[ -s /Users/mike/.rvm/scripts/rvm ]] ; then source /Users/mike/.rvm/scripts/rvm ; fi

的httpd.conf

LoadModule passenger_module /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
PassengerRoot /Users/mike/.rvm/gems/ree-1.8.7-2010.01/gems/passenger-2.2.11
#PassengerRuby /Users/mike/.rvm/rubies/ree-1.8.7-2010.01/bin/ruby
PassengerRuby /Users/mike/.rvm/bin/passenger_ruby
RailsEnv development

的httpd-vhosts.conf

<VirtualHost *:80>
    DocumentRoot /Library/WebServer/Documents
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
   ServerName XXX.local
   DocumentRoot /Users/mike/Projects/XXX/XXX/public/
      <Directory  /Users/mike/Projects/XXX/XXX/public/>
         AllowOverride all
         Options -MultiViews
         Allow from all
      </Directory>
</VirtualHost>

的/ etc /主机

127.0.0.1       XXX.local

框架

  • 默认的mac apache安装
  • 乘客(如此安装:http://www.modrails.com/install.html
  • rvm(rvm --default ree; rvm gemset create XXX; echo“rvm ree @XXX;”&gt; /Users/mike/Projects/XXX/XXX/.rvmrc)
  • ree(rvm install ree)
  • mysql 5.1.46 64来自dmg(gem install mysql - --with-mysql-lib = / usr / local / mysql / lib --with-mysql -include = / usr / local / mysql / include)< / LI>

1 个答案:

答案 0 :(得分:0)

问题出在我的〜/ .rvm / bin / passenger_ruby文件中。出于某种原因,GEM_PATH和PATH包括ree-1.8.7-2010.01和ree-1.8.7-2010.01@global,但不包括ree-1.8.7-2010.01@XXX,这是我安装了所有宝石的地方。< / p>

将ree-1.8.7-2010.01@XXX添加到GEM_PATH和PATH修复了问题。我不知道是否有更好的解决方案。