Forum: Ruby on Rails Dreaded "Application error" Apache2

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
paul (Guest)
on 2005-12-06 03:15
(Received via mailing list)
Hello,

I've been struggling for well over 6 hours which qualifies me as
being allowed to post a question to the list.

I am trying to get my Rails application to run under Apache. It works
fine with WEBrick. Apache is failing in both the cgi and fastcgi modes.

Configuration: Rails 0.14.3, Apache 2.0.50, Ruby 1.8.3, Postgres 8.1,
fcgi-2.4.0, ruby-fcgi-0.8.6.1, SaltedHashLoginGenerator

The permissions all seem to be fine (0755 on the dispatch.* files,
although many variations succeeded and failed as expected) and the
path to Ruby is correct (#!/usr/local/bin/ruby)

No matter what I do, I get the dreaded "Application error Rails
application failed to start properly" error. Some of the interesting
things I've found include:

When I run public/dispatch.rb, public/dispatch.cgi, and public/
dispatch.fcgi I get a "Status: 500 Internal Server Error". Is this
normal?

How about this excerpt from the console, entering the contents of
dispatch.cgi line-by-line, and then trying variations until things work:

Loading development environment.
 >> require File.dirname(__FILE__) + "/../config/environment" unless
defined?(RAILS_ROOT)
=> nil
 >> require File.dirname(__FILE__) + "/../config/environment"
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/initializer.rb:
222: warning: already initialized constant Controllers
=> true
 >> require "dispatcher"
=> true
 >> ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if
File.directory?(dir) } if defined?(Apache::RubyRun)
=> nil
 >> ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if
File.directory?(dir) }
NameError: uninitialized constant ADDITIONAL_LOAD_PATHS
         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.3/
lib/active_support/dependencies.rb:200:in `const_missing'
         from (irb):4
 >> Dispatcher.dispatch
Status: 500 Internal Server Error
=> 35
 >>

Does this make sense? I get the same kind of error from the .fcgi:

Loading development environment.
 >> require File.dirname(__FILE__) + "/../config/environment" unless
defined?(RAILS_ROOT)
=> nil
 >> require File.dirname(__FILE__) + "/../config/environment"
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/initializer.rb:
222: warning: already initialized constant Controllers
=> true
 >> require 'fcgi_handler'
=> true
 >> RailsFCGIHandler.process!
Status: 500 Internal Server Error
=> true

Strange that it replies "true"..

Does anyone have any idea? Will switching to lighttpd allow me to
avoid this problem?

Thanks for your help,

Paul.
nicholas.stuart (Guest)
on 2005-12-06 16:42
(Received via mailing list)
One thing that bit me was in the dispatch.fcgi. Check the first line,
is it pointing to the right spot for ruby? Looks as though your on a
linux environment, so something like '/usr/local/bin/ruby' or where
ever it may be should do the trick.

If thats not it, are any log files getting generated when you try to
start apache? If so which ones?

Also, check to make sure you actually have the requested envirornments
database loaded, if not this leads to weird errors that you wouldn't
expect (dont ask how I know). :)  Its probably not an issues as it
looks like you are trying to run in the same env as the webrick
server.

-Nick
nicholas.stuart (Guest)
on 2005-12-06 16:47
(Received via mailing list)
One more note, there was another problem I had like this where the 500
error would seem to pop up and random. I also use the SaltedLogin
generator, but I have more then one class/user type that requires
authentication. I had forgot to require the second user type to my
lib/login_system.rb so that when it was getting the information from
the cookies it wouldn't marshal the objects back out correctly. (took
me a bit to find that one too)

Hope some of this helps!
-Nick
This topic is locked and can not be replied to.