Redmine+Bundler - method_missing "has_key?"

Added by bike zilla about 9 years ago

I'm running two RoR applications on the same server (one of which being Redmine). Since the applications use different versions of gems (such as Rails, 2.3.8 vs 2.3.5), I'm using Bundler to run them with "bundle exec". The servers I use are thin+nginx.

Everything was working fine before yesterday I updated several gems on the system, including Bundler to 1.0.10.
Since then, when I try to run the thin server with bundle exec, I get the following exception:

/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in `method_missing': undefined method `has_key?' for nil:NilClass (NoMethodError)
        from /root/redmine-1.1/lib/redmine/menu_manager.rb:77:in `add'
        from /root/redmine-1.1/lib/redmine/menu_manager.rb:371:in `push'
        from /root/redmine-1.1/lib/redmine.rb:149
        from /root/redmine-1.1/lib/redmine/menu_manager.rb:301:in `map'
        from /root/redmine-1.1/lib/redmine.rb:148
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
        from /root/redmine-1.1/config/initializers/30-redmine.rb:14
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:622:in `load_application_initializers'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:621:in `each'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:621:in `load_application_initializers'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:176:in `process'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
        from /root/redmine-1.1/config/environment.rb:31
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
        from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
        from script/server:3:in `require'
        from script/server:3

This is my Gemfile:

source :gemcutter
#
# gem "rails" 
gem "rack","1.0.1" 
gem "rake","0.8.7" 
gem "rails", "2.3.5" 
gem "RedCloth","~>4.2.3", :require => "redcloth" 
gem "activesupport", "2.3.5" 
gem "i18n", "0.4.2" 
gem "thin" 
gem "rubytree", :require => "tree" 
gem "mysql" 
gem "builder" 

Strangely as it is, when I remove all the Bundler setup lines from boot.rb, I can run the application successfully through Webrick (script/server). However, thin is unable to find the 2.3.5 rails and 1.0.1 rack gems on it's own, and complains ... this implies running through Bundler, which produces the above exception.

I've already lost hours on this with no progress. I guess I'm missing some gem in my Gemfile?
Any help will be highly appreciated. Thanks a lot.

p.s. the same issue is observed with redmine 1.0.0, 1.1.0 and 1.1.0.

Replies (8)

RE: Redmine+Bundler - method_missing "has_key?" - Added by Felix Schäfer about 9 years ago

What version of rubygems do you have?

RE: Redmine+Bundler - method_missing "has_key?" - Added by bike zilla about 9 years ago

# gem list | grep rubygems
rubygems-update (1.5.0, 1.4.2, 1.3.7, 1.3.6)

Specifying any of these in the Gemfile does not solve the issue.

RE: Redmine+Bundler - method_missing "has_key?" - Added by Felix Schäfer about 9 years ago

IIRC rubygems 1.5 removed (long deprecated) methods rails 2.3.5 relies on. Remove rubygems 1.5 and try again.

RE: Redmine+Bundler - method_missing "has_key?" - Added by Lee Pope about 9 years ago

Worked through the same issue today; seems like the problem is a new version of rubytree; MenuManager is expecting an older version that had an instance variable called @childrenHash, which has been changed to @children_hash. See the attached patch.

menu_manager.patch Magnifier - patch for menu_manager.rb (2.49 KB)

RE: Redmine+Bundler - method_missing "has_key?" - Added by Lee Pope about 9 years ago

Wrong direction for patch -- sorry!

menu_manager.patch Magnifier (2.49 KB)

RE: Redmine+Bundler - method_missing "has_key?" - Added by Jason Waldrip almost 9 years ago

This issue seems to be fixed when viewing the site. But my rake command still throws an error.

$ rake -f /home/ec2-user/redmine/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=imap.gmail.com ssl=SSL port=993 move_on_success=FILED move_on_failure=IGNORED username=miner@socialline.me password=********* --trace
(in /home/ec2-user)
** Invoke redmine:email:receive_imap (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `has_key?' for nil:NilClass
/home/ec2-user/redmine/lib/redmine/menu_manager.rb:77:in `add'
/home/ec2-user/redmine/lib/redmine/menu_manager.rb:371:in `push'
/home/ec2-user/redmine/lib/redmine.rb:149
/home/ec2-user/redmine/lib/redmine/menu_manager.rb:301:in `map'
/home/ec2-user/redmine/lib/redmine.rb:148
/opt/rubyee/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
/opt/rubyee/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
/opt/rubyee/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:184:in `require'
/home/ec2-user/redmine/vendor/plugins/redmine_s3/rails/../init.rb:1
/opt/rubyee/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
/opt/rubyee/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
/opt/rubyee/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:184:in `require'
/home/ec2-user/redmine/vendor/plugins/redmine_s3/rails/init.rb:1:in `evaluate_init_rb'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/plugin.rb:158:in `evaluate_init_rb'
/opt/rubyee/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/plugin.rb:154:in `evaluate_init_rb'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/plugin.rb:48:in `load'
/home/ec2-user/redmine/config/../vendor/plugins/engines/lib/engines/plugin.rb:44:in `load'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/plugin/loader.rb:38:in `load_plugins'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/plugin/loader.rb:37:in `each'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/plugin/loader.rb:37:in `load_plugins'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:369:in `load_plugins'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:165:in `process'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in `send'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in `run'
/home/ec2-user/redmine/config/environment.rb:20
/opt/rubyee/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
/opt/rubyee/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
/opt/rubyee/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/opt/rubyee/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
/opt/rubyee/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
/opt/rubyee/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/tasks/misc.rake:4
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/rubyee/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/opt/rubyee/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/opt/rubyee/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/bin/rake:19:in `load'
/bin/rake:19

RE: Redmine+Bundler - method_missing "has_key?" - Added by Eslam El Husseiny over 8 years ago

i have the same problem
and here you are the errors i face in the attached file

redmin_errors (9.57 KB)

RE: Redmine+Bundler - method_missing "has_key?" - Added by Sudipto Dey over 8 years ago

check your redmine_apps/vendor/gems contains folder named rubytree-0.5.2 or not. ( In my case it is v-0.5.2)

If it is not there install it and hopefully your problem will be solved. In my case it worked out.

(1-8/8)