What does “/…../mongrel.rb:15: warning: already initialized constant OPTIONS” means?

It turns out that our Rails installation has a problem cause I always got those error message when I tried to start server. Here is the complete logs if you’re curious:

bpdp@akakom:~/src/tbar$ script/server webrick
=> Booting WEBrick...
/opt/software/ruby/gems/rails-1.2.3/lib/commands/servers/webrick.rb:11: warning: already initialized constant OPTIONS
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
Exiting
/opt/software/ruby/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:15: warning: already initialized constant OPTIONS
/opt/software/ruby/gems/rails-1.2.3/lib/commands/servers/mongrel.rb:18: undefined method `options' for []:Array (NoMethodError)
        from /opt/software/ruby//lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'
        from /opt/software/ruby//lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
        from /opt/software/ruby/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
        from /opt/software/ruby/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in'
        from /opt/software/ruby/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require'
        from /opt/software/ruby/gems/rails-1.2.3/lib/commands/server.rb:39
        from /opt/software/ruby//lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require'
        from /opt/software/ruby//lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
        from script/server:3
bpdp@akakom:~/src/tbar$

So I started to find the solution online, but none helps. Some posts said that this error showed up because Rails can not find dependenc{y/ies} for some of its plugins. Hmm … ok, then it looks like I have to manually search for every plugins’ dependencies and then install them.

How to do that?

Easy. All I have to do is remove all of the plugins (I just move it to directory $RAILS_ROOT/tmp/plugins which I created myself) and then start move it one by one to $RAILS_ROOT/vendor/plugins and test it using $RAILS_ROOT/script/server webrick.

Then I found that activemerchant is my problem. I need builder gem.

It’s all easy but the error messages was really a mess :)

4 comments so far

  1. prash on

    thanks! this helped!
    also for those with r/image-magick issues, if you installed imagemagick on windows, it sets a path with a space in it (“Program Files”) and this is why the CORE_ dlls are not being found.
    two ways to fix:
    either put quotes around the path to IMageMagick dlls, or copy the dlls to c:\ruby\bin
    good luck!

  2. rikas on

    Yeah the error code shows us nothing! Glad i found this explanation. I had plugin dependencies problem too. Thanks

  3. Mario Lanza on

    I am 100% tired of this message. I see it all too often and it’s not always as easy as removing and replacing plugins. This error wastes hours and hours of my times. I can start my rails app with webrick just fine. It’s mongrel that chokes. This error message provides no help in resolving the real issue.

  4. ruby developer on

    update your gems

    gem update –system

    good luck


Leave a reply