Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninitialized constant MQ::Exchange::AMQP #22

Closed
threetee opened this issue Apr 22, 2010 · 6 comments
Closed

Uninitialized constant MQ::Exchange::AMQP #22

threetee opened this issue Apr 22, 2010 · 6 comments

Comments

@threetee
Copy link

On CentOS 5.4 with RubyEE 1.8.7, the amqp template generated by daemon-kit 0.1.8rc2 won't start. This also occurs on Mac OS X 10.6.3 with Ruby 1.8.7.


[root@host ~]# daemon-kit amqp -i amqp
<generates daemon>
[root@host ~]# cd amqp
[root@host amqp]# bin/amqp 
/usr/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/mq/exchange.rb:23: uninitialized constant MQ::Exchange::AMQP (NameError)
    from /usr/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/mq.rb:9:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/mq.rb:9
    from /usr/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/mq.rb:8:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/amqp-0.6.7/lib/mq.rb:8
    from /root/src/daemons/amqp/config/pre-daemonize/amqp.rb:3:in `require'
    from /root/src/daemons/amqp/config/pre-daemonize/amqp.rb:3
    from /usr/local/lib/ruby/gems/1.8/gems/daemon-kit-0.1.8rc2/lib/daemon_kit/initializer.rb:155:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/daemon-kit-0.1.8rc2/lib/daemon_kit/initializer.rb:155:in `load_predaemonize_configs'
    from /usr/local/lib/ruby/gems/1.8/gems/daemon-kit-0.1.8rc2/lib/daemon_kit/initializer.rb:152:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/daemon-kit-0.1.8rc2/lib/daemon_kit/initializer.rb:152:in `load_predaemonize_configs'
    from /usr/local/lib/ruby/gems/1.8/gems/daemon-kit-0.1.8rc2/lib/daemon_kit/initializer.rb:99:in `before_daemonize'
    from /usr/local/lib/ruby/gems/1.8/gems/daemon-kit-0.1.8rc2/lib/daemon_kit/initializer.rb:58:in `run'
    from ./bin/../config/boot.rb:39:in `run'
    from ./bin/../config/boot.rb:19:in `boot!'
    from ./bin/../config/boot.rb:70
    from ./bin/../config/environment.rb:7:in `require'
    from ./bin/../config/environment.rb:7
    from bin/amqp:6:in `require'
    from bin/amqp:6

@threetee
Copy link
Author

Gem versions:
amqp (0.6.7)
daemon-kit (0.1.8rc2)
eventmachine (0.12.10)

@kennethkalmer
Copy link
Owner

This happens because the generated daemon has a 'lib/amqp.rb' file generated, and the amqp initialization code requires that file instead of the amqp.rb file in the rubygem. The project name must not conflict with the names of any libraries installed via rubygems or this will happen.

Thanks for reporting !

@threetee
Copy link
Author

threetee commented May 3, 2010

Renaming the generated daemon did indeed resolve this problem. Thanks for the reply!

@gcampbell
Copy link

I got this error today after upgrading to DaemonKit 0.1.8 and generating a new daemon with the amqp installer.

@gcampbell
Copy link

The issue appears to be in boot.rb. GemBoot#load_initializer requires 'daemon_kit/initializer', which adds lib/daemon_kit to the load path. Later on, when 'amqp' is required, it requires lib/daemon_kit/amqp, which requires 'mq', which throws the error. I was able to work around this by throwing in a require 'amqp' somewhere before this line.

@kennethkalmer
Copy link
Owner

Thanks for reporting, seems to only affect Ruby 1.8.7, while working fine with 1.9.1. I'm testing out a fix.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants