简体   繁体   中英

Ruby on Rails Mongrel error

When I click on the "about your application's environment" button on the "welcome" your riding rails page this happens in my server console.

** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  INT => stop (no restart).
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.
Sat Jul 17 02:24:28 -0400 2010: Error calling Dispatcher.dispatch #<NoMethodErro
r: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split>
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controll
er/cgi_process.rb:52:in `dispatch_cgi'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controll
er/dispatcher.rb:101:in `dispatch_cgi'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controll
er/dispatcher.rb:27:in `dispatch'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/rails.rb:76:in `process'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/rails.rb:74:in `synchronize'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/rails.rb:74:in `process'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:159:in `process_client'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:158:in `each'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:158:in `process_client'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `initialize'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `new'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:285:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:268:in `initialize'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:268:in `new'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel.rb:268:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/configurator.rb:282:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/configurator.rb:281:in `each'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/configurator.rb:281:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon
grel_rails:128:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/../
lib/mongrel/command.rb:212:in `run'
C:/INSTAN~1.0-W/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mon
grel_rails:281
C:/INSTAN~1.0-W/ruby/bin/mongrel_rails:19:in `load'
C:/INSTAN~1.0-W/ruby/bin/mongrel_rails:19

Here are the versions

C:\InstantRails-2.0-win\rails_apps>rails -v
Rails 2.3.8

C:\InstantRails-2.0-win\rails_apps>ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

C:\InstantRails-2.0-win\rails_apps>gem -v
1.3.7

C:\InstantRails-2.0-win\rails_apps>gem install mongrel
Successfully installed mongrel-1.1.5-x86-mswin32-60
1 gem installed
Installing ri documentation for mongrel-1.1.5-x86-mswin32-60...
Installing RDoc documentation for mongrel-1.1.5-x86-mswin32-60...

This issue is discussed at great lengths on the Rails bugtracker . The ultimate fix seems to be "get with the times" and move to Rails 3.x, but for those of us who can't just yet, there is a workaround.

You can download this mongrel.rb into your config/initializers directory. That seems to make pages load, but resources (stylesheets, javascript) don't seem to be loading. I am investigating further, but wanted to throw this out there as a quick pointer in the right direction.

I will update this answer as I learn more.

I'm not able to reproduce (I'm on Ruby 1.9.1 mingw32 right here), but line 52 of cgi_process.rb is calling

if headers.include?('Set-Cookie')
  headers['cookie'] = headers.delete('Set-Cookie').split("\n")
end

maybe try checking your session key and cookie settings in environment.rb, and try running ruby script/server webrick (instead of mongrel) to see if that is the issue.

I also know that "about your application" link blows up if you don't have a database created or setup in database.yml, so check that too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM