Frustrating "require" problems

Hi,

Recently I got the error with accompaning warning "warning: already
initialized constant OPTIONS"
and don't know how to get rid of it.

For me, it has something to do with dependencies.
I have looked for similar error-threads but could not find the help
that I need to resolve it in a good structured way.
Starting with Rails v.1.2.3 and later Rails v.1.2.5 and now Rails
2.0_PR.
I have tried a lot of things (like rebuilding plugins directory,
config/environment settings), but I AM NOT AN EXPERT!

I WOULD LIKE TO LEARN MORE, SO THAT I CAN TAKLE THESE BLOCKING
ERRORS!!!

So, my questions are simple:

1. Where can I find the right information to fully understand what is
going on, so that I can better test and isolate the problem and maybe
one day know enough to ask for the correct solution?
2. I have already some good books on Ruby and Ruby on Rails (AWDR,
Cookbook, RailsRecipes,
Ruby for Rails), but I do miss some good info on environment/gems/
plugins/dependencies. Where can I find that?

For immediate help, here is the error message:

6699
=> 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
Exiting
/Users/creemej/Documents/PROJECTS/SVN/sjamayee/vendor/rails/railties/
lib/commands/servers/mongrel.rb:16: warning: already initialized
constant OPTIONS
/Users/creemej/Documents/PROJECTS/SVN/sjamayee/vendor/rails/railties/
lib/commands/servers/mongrel.rb:19: undefined method `options' for
#<Array:0x24b0404> (NoMethodError)
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in `gem_original_require'
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
32:in `require'
  from /Users/creemej/Documents/PROJECTS/SVN/sjamayee/vendor/rails/
activesupport/lib/active_support/dependencies.rb:496:in `require'
  from /Users/creemej/Documents/PROJECTS/SVN/sjamayee/vendor/rails/
activesupport/lib/active_support/dependencies.rb:342:in
`new_constants_in'
  from /Users/creemej/Documents/PROJECTS/SVN/sjamayee/vendor/rails/
activesupport/lib/active_support/dependencies.rb:496:in `require'
  from /Users/creemej/Documents/PROJECTS/SVN/sjamayee/vendor/rails/
railties/lib/commands/server.rb:39
  from ./script/server:3:in `require'
  from ./script/server:3
  from -e:4:in `load'
  from -e:4

Hi,

From my experience, maybe you did not install plugins that has been

set on the environment.rb. So, check the environment.rb if you include
any plugin like these:
  require_gem "acts_as_taggable"
  require 'rmagick'

Chamnap

Nice try, but my environment.rb is almost empty.

Here it is with a lot of comment-lines stripped out:

# Be sure to restart your web server when you modify this file.
# Specifies gem version of Rails to use when vendor/rails is not
present
RAILS_GEM_VERSION = '1.2.5' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default
configuration
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
end
# Include your application configuration below
OpenIdAuthentication.store = :file

This is the environment.rb from a standard project, which gives the
same error when starting the Mongrel-server.
This simple (initial project) works fine with the Webrick server.

But in other projects produce the same error with both servers
(mongrel, webrick).

So, the error must be in the rails/ruby/gems environment and freezing
rails did not help needer.
I am now using rails_v_1.2.5, buth going back to rails_1.2.3, 1.2.1
didn't help.
I need some deep understanding of environment/gems/dependencies/
plugins/require and more ...

thanks for the help and keep trying.

Hi,

Recently I got the error with accompaning warning "warning: already
initialized constant OPTIONS"
and don't know how to get rid of it.

...

6699
=> 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
Exiting
/Users/creemej/Documents/PROJECTS/SVN/sjamayee/vendor/rails/railties/
lib/commands/servers/mongrel.rb:16: warning: already initialized
constant OPTIONS
/Users/creemej/Documents/PROJECTS/SVN/sjamayee/vendor/rails/railties/
lib/commands/servers/mongrel.rb:19: undefined method `options' for
#<Array:0x24b0404> (NoMethodError)

The options method is added to ARGV by optparse.rb (standard ruby).

Does this happen with a plain vanilla rails app, or only with your
specific app? If it happens to all apps, I think something is hosed
with your Ruby installation or your Mongrel gems. If it's happening
only with one app, something in config/environment.rb is the culprit.
You need to eliminate items one by one until the problem goes away and
then focus your efforts there.

Hi Bob,

I fully agree with you.
It must be something in the Ruby environment (gems).
I have again created a new initial project and it has this error when
starting Mongrel-server, but not in the Webrick-server.

For me, it must be something with a gem, that is not compatible with
the Rails v.1.2.5.
Not specialy linked to mongrel, because in my other projects the error
is everywhere.

I will try to rebuild the gems directory, peace by peace and test with
the different projects.
But I think that there should be an easier way to locate this error.

Hope that this succeeds ...