Read more

Fixing "uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)"

Ulrich Berkmueller
March 09, 2011Software engineer

RubyGems 1.6.0 has undergone some changes which may cause Rails 2.x applications to break with an error like this one (e.g. when running script/server):
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

Fix it by adding the following not only to your environment.rb but also into your script/server file, in both cases before boot.rb is required.
require 'thread'

If you still get the error above you can also add require 'thread' in your boot.rb after the RAILS_ROOT constant was defined.
RAILS_ROOT = "#{File.dirname(FILE)}/.." unless defined?(RAILS_ROOT)
require 'thread'

Posted by Ulrich Berkmueller to makandra dev (2011-03-09 10:06)