Reputation: 3246
I'm trying to use newrelic in my project. I've installed newrelic gem successfully and the next step was adding config.gem "newrelic_rpm" to environment.rb
When I use config.gem in environment.rb I'm getting Ruby on Rails application could not be started However using config.gem "dfgdsgsdgsdfg" causes the same error.
How can I solve the problem?
I'm running Debian Linux, Apache2, RVM 1.8.6, Passenger 3, Rails 2.3.5, Ruby 1.8.7, gem 1.8.10
Here is my environment.rb
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
config.gem "newrelic_rpm"
config.time_zone = 'UTC'
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_content_type = "text/html"
config.action_mailer.smtp_settings = {
:address => "smtp.xxx.xx",
:port => 25,
:domain => "xxxx.com",
:authentication => :login,
:user_name => "[email protected]",
:password => "xxxxx"
:enable_starttls_auto => true
}
end
and full backtrace
Ruby on Rails application could not be started
Error message:
undefined method `name' for "actionmailer":String
Exception class:
NoMethodError
Application root:
/var/www/ytndweb/data/www/rc.xxxx.xx
Backtrace:
# File Line Location
0 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.5/lib/rails/gem_dependency.rb 268 in `=='
1 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/dependency.rb 217 in `==='
2 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/dependency.rb 217 in `matching_specs'
3 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 36 in `find_all'
4 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/specification.rb 410 in `each'
5 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/specification.rb 409 in `each'
6 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/dependency.rb 216 in `find_all'
7 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/dependency.rb 216 in `matching_specs'
8 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/dependency.rb 238 in `to_specs'
9 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/dependency.rb 256 in `to_spec'
10 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems.rb 1210 in `gem'
11 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.5/lib/rails/gem_dependency.rb 73 in `add_load_paths'
12 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.5/lib/initializer.rb 301 in `add_gem_load_paths'
13 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.5/lib/initializer.rb 301 in `each'
14 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.5/lib/initializer.rb 301 in `add_gem_load_paths'
15 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.5/lib/initializer.rb 132 in `process'
16 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.5/lib/initializer.rb 113 in `send'
17 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.5/lib/initializer.rb 113 in `run'
18 /var/www/ytndweb/data/www/rc.yetonado.ru/config/environment.rb 10
19 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 36 in `gem_original_require'
20 /usr/local/rvm/rubies/ruby-1.8.7-p352/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 36 in `require'
21 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb 222 in `preload_application'
22 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb 181 in `initialize_server'
23 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb 572 in `report_app_init_status'
24 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb 174 in `initialize_server'
25 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 204 in `start_synchronously'
26 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 180 in `start'
27 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb 149 in `start'
28 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 219 in `spawn_rails_application'
29 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb 132 in `lookup_or_add'
30 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 214 in `spawn_rails_application'
31 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb 82 in `synchronize'
32 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb 79 in `synchronize'
33 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 213 in `spawn_rails_application'
34 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 132 in `spawn_application'
35 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 275 in `handle_spawn_application'
36 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 357 in `__send__'
37 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 357 in `server_main_loop'
38 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb 206 in `start_synchronously'
39 /usr/local/rvm/gems/ruby-1.8.7-p352/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server 99
Upvotes: 1
Views: 607
Reputation: 123
Preface: I work for New Relic.
Instead of using config.gem just add:
require "newrelic_rpm"
after the initializer and it should work just fine :) I wish I had a reason why you have to do it that way, but I don't. It's just an ol' trick I remember when I was still working on Rails 2.x apps (I never had good luck with config.gem).
Upvotes: 3