Rails应用程序无法启动

时间:2011-04-26 23:47:04

标签: ruby-on-rails ruby ruby-on-rails-3

我有一个新的应用程序在我做

时给我错误
rails server

这是错误:

/home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/script_rails_loader.rb:11: warning: Insecure world writable dir /home/agenadinik in PATH, mode 040777
/home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.12/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /home/agenadinik in PATH, mode 040777
=> Booting WEBrick
=> Rails 3.0.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/builder.rb:35:in `eval': /home/agenadinik/workspace/udfr/config.ru:6: syntax error, unexpected keyword_end, expecting ')' (SyntaxError)
    from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/builder.rb:35:in `parse_file'
    from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:162:in `app'
    from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:248:in `wrapped_app'
    from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:213:in `start'
    from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/server.rb:65:in `start'
    from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:30:in `block in <top (required)>'
    from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
    from /home/agenadinik/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

似乎在抱怨我的config.ru文件。这是:

# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment',  __FILE__)
run Udfr::Application

这是我的environment.rb文件:

# Load the rails application
require File.join(File.dirname(__FILE__), 'boot')
require File.expand_path('../application', __FILE__)

if RUBY_PLATFORM =~ /java/
  require 'rubygems'
  RAILS_CONNECTION_ADAPTERS = %w(jdbc)
end

# Initialize the rails application
Rails::Initializer.run do |config|
Udfr::Application.initialize!

我根据这些说明更改了该文件: http://www.digitalsanctum.com/2007/07/24/jruby-deploying-a-rails-application-on-tomcat/ 知道问题是什么吗?

1 个答案:

答案 0 :(得分:1)

您遵循的说明适用于Rails 2,不适用于您的Rails 3应用程序。

让Ruby on Rails在jruby上运行的updated instructions是编辑你的gemfile并将你的gem需求放在那里。

Gemfile

if defined?(JRUBY_VERSION)
  gem 'activerecord-jdbc-adapter'
end

然后运行bundle