PDA

View Full Version : Bort RoR startup application error



gemorgan
10-21-2008, 11:48 AM
Hey all,

Anyone try starting a RoR app using the bort build? I unpacked it, modified the settings.yml, database.yml files to the correct settings, migrate the db (works fine) but when I go to the main page of the app or any other I get

Application error
Rails application failed to start properly

Any ideas what's up? I have had nothing but 2 weeks of frustration trying to get RoR working on my account here...

PS I should add that I can get a plain boring app to work fine by building from scratch on BH (rails newapp, modify database.yml, generate scaffold person name:string age:integer, rake db:migrate, delete index.html, place the .htaccess file in public, navigate to site it works fine)...

peterbanjo
10-25-2008, 12:07 PM
I am having the same problem.

I have tried following the famed tutorial and changing my .htaccess and contacting customer support.

Have you found a solution yet?

parabuzzle
11-10-2008, 04:22 PM
So go to your public directory in your app and run dispatch.rb

If you get a message similar to this: Missing the Rails 2.1.0 gem. Please `gem install -v=2.1.0 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

then run rails -v

If the versions don't match then the version in your config/environment.rb that is the problem. I suspect that Bluehost, in their infinite wisdom, just upgraded the gems and removed old gems without telling anyone. I wrote my app to the 2.1.0 spec and I just updated my environment file to use 2.1.2 and I haven't had an error yet. You can also just comment the RAILS_GEM_VERSION out of the file and this won't happen again but you risk bluehost updating to version 3 or something in the future and everything breaking.

rmalone
11-26-2008, 10:41 PM
OK, so I've been caught by the Bluehost unexpected upgrade a couple times now, so when I got the Application Error - Rails failed to start, blah blah this time, I thought I knew what I was doing. I checked the version and sure enough, 2.2.2, my environment.rb file says 2.1.2 (from earlier this month when it screwed me up before!)

So I changed it to 2.2.2 and...nothing. Still get the error. I found this thread and tried running the dispatch.rb file, which does NOT display the error for me, but instead dumps out the generated html I should be seeing in my browser. But, I'm not getting that when I actually try to view the page!

Any ideas? So far the best one I've come up with is "beer" but I don't think that's going to solve my immediate problem...

[EDIT]

Wait -- I just re-ran dispatch.rb, for fun, and this time I get a completely different error. It looks like when I have the version set to 2.1.2, I am getting the html dump, but when it is 2.2.2, I get this:


# ruby dispatch.rb
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:530:in `send': undefined method `cache_template_loading=' for ActionView::Base:Class (NoMethodError)
from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:530:in `initialize_framework_settings'
from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:529:in `each'
from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:529:in `initialize_framework_settings'
from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:526:in `each'
from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:526:in `initialize_framework_settings'
from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:154:in `process'
from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in `send'
from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in `run'
from ./../config/environment.rb:13
from dispatch.rb:3:in `require'
from dispatch.rb:3


So, it's not my version, it's something else. But I can't figure out what!

rmalone
11-26-2008, 10:54 PM
Aaaand I spoke too soon again.

Found the problem -- apparently, I needed to remove the
config.action_view.cache_template_loading

line from config/environments/production.rb

Once I did that, magic! I owe it to the beer.

Hopefully this will help someone else.

eds
12-01-2008, 06:03 AM
Hello,

Thanks for your advice. I was having the same problem after bluehost upgraded rails to 2.2.2.

However after commenting out the line in production.rb, I experience a new problem. I get an http 404 error (page not found). Seems that something else has changed in the rails routing or in the http server. Of course I am using the same url's as before the upgrade.

Please can somebody help me!!.:confused:

By the way, I am a little tired of spending a lot of time in troubelshooting everytime there is a rails upgrade. I can not understand why it has to be so painfull.

Thanks in advance!!

badreligion
12-02-2008, 05:00 PM
By the way, I am a little tired of spending a lot of time in troubelshooting everytime there is a rails upgrade. I can not understand why it has to be so painfull.

I'm not saying BlueHost is using the simplest method of supporting Rails, but have you ever met Rails deployment face to face?! Passenger is the only way to do it without facing certain insanity at some point. Rails is still very new and not mature as far as deployment goes, though its quickly growing :)

Eds:
What you need to determine is if the 404 is coming from Apache or from Rails. That would be my first move. If its coming from Apache then you more than likely have a rewrite rule problem. If its from Rails then it is probably a routing problem. Look in the Apache access logs to see if Apache is serving up the 404 error. If its not then you know Rails is, so then look in your Rails log and see what the error is. If you can't figure it out post it here and hopefully one of us can help you.

BR

eds
12-03-2008, 06:35 AM
Hi,

Many Thanks for your interest.

The problem seems to be in the rails routing. This is what production.log says:


ActionController::RoutingError (No route matches "/.../public/access/login" with {:method=>:get}):
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/recognition_optimisation.rb:66:in `recognize_path'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/route_set.rb:386:in `recognize'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:182:in `handle_request'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/fcgi_handler.rb:101:in `process_request'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/fcgi_handler.rb:151:in `with_signal_handler'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/fcgi_handler.rb:99:in `process_request'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/fcgi_handler.rb:76:in `process_each_request'
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in `each_cgi'
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:117:in `session'
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:104:in `each_request'
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:36:in `each'
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in `each_cgi'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/fcgi_handler.rb:75:in `process_each_request'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/fcgi_handler.rb:74:in `catch'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/fcgi_handler.rb:74:in `process_each_request'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/fcgi_handler.rb:49:in `process!'
/usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/fcgi_handler.rb:23:in `process!'
dispatch.fcgi:24

Needless to say, the url was working fine before the rails update. I haven't change a comma in the code or in the configuration. May be this new version of RoR has changed something in the way routing rules are applied. I do not know.

I am refraining myself to start changing routing rules or whatever in my code. As I said, everything was working fine before. The only solution I see is to re-generate the application and deploy the code again ...



Best Regards.

scottdc
12-03-2008, 10:13 AM
Eds, I was seeing the exact same problem after the 2.2.2 upgrade and got mine working by adding 'config.action_controller.relative_url_root = "/subfolder_my_app_is_in" ' to my environment.rb file.

mackcenter
12-04-2008, 06:14 PM
... got mine working by adding 'config.action_controller.relative_url_root = "/subfolder_my_app_is_in" ' to my environment.rb file.

Thanks so much, this fixed my problem too!

eds
12-06-2008, 04:07 AM
Many Thanks. It solved my problem too!

Best Regards.

dennismajor1
01-05-2009, 08:46 AM
To avoid Bluehost RAILS upgrade creating problems for your RAILS apps simply "freeze" the version of RAILS you used to develop your app into your app's vendor folder - not sure how to do the freeze then go to RAILS site and check RAILS documentation re freeze/unfreeze.

Your RAILS app then references the vendor RAILS version and BlueHost RAILS upgrades can no have an impact on your app.