NoMethodError:ActiveRecord :: ConnectionAdapters :: Mysql2Adapter:Class的未定义方法`type_cast_config_to_integer'

时间:2018-09-21 04:52:34

标签: ruby-on-rails ruby jrubyonrails

我正在尝试在Ubuntu平台上为mysql设置我的第一个Rails项目(JRuby)。我使用创建了项目 滑轨新MyFirstRailsProject -d mysql

现在,在使用rails服务器启动rails服务器时,出现以下错误。

rails server
/JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activesupport-3.2.13/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
NoMethodError: undefined method `type_cast_config_to_integer' for ActiveRecord::ConnectionAdapters::Mysql2Adapter:Class
             method_missing at org/jruby/RubyBasicObject.java:1657
                 initialize at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-50.0/lib/arjdbc/abstract/statement_cache.rb:25
                 initialize at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-50.0/lib/arjdbc/mysql/adapter.rb:34
            jdbc_connection at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-50.0/lib/arjdbc/jdbc/connection_methods.rb:15
           mysql_connection at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-50.0/lib/arjdbc/mysql/connection_methods.rb:76
             new_connection at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315
    checkout_new_connection at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325
          block in checkout at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247
                       loop at org/jruby/RubyKernel.java:1316
          block in checkout at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242
            mon_synchronize at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/stdlib/monitor.rb:214
                   checkout at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239
        block in connection at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102
            mon_synchronize at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/stdlib/monitor.rb:214
                 connection at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101
        retrieve_connection at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410
        retrieve_connection at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171
                 connection at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145
           block in Railtie at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activerecord-3.2.13/lib/active_record/railtie.rb:88
              instance_exec at org/jruby/RubyBasicObject.java:1728
                        run at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/railties-3.2.13/lib/rails/initializable.rb:30
  block in run_initializers at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/railties-3.2.13/lib/rails/initializable.rb:55
                       each at org/jruby/RubyArray.java:1735
           run_initializers at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/railties-3.2.13/lib/rails/initializable.rb:54
                initialize! at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/railties-3.2.13/lib/rails/application.rb:136
             method_missing at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30
                     <main> at /home/jayvijay/RailsTestProject/MyFirstRailsProject/config/environment.rb:5
                    require at org/jruby/RubyKernel.java:956
           block in require at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251
            load_dependency at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236
                    require at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251
            block in (root) at /home/jayvijay/RailsTestProject/MyFirstRailsProject/config.ru:1
              instance_eval at org/jruby/RubyBasicObject.java:1691
                 parse_file at /home/jayvijay/RailsTestProject/MyFirstRailsProject/config.ru:3
                     <eval> at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/rack-1.4.7/lib/rack/builder.rb:51
                       eval at org/jruby/RubyKernel.java:995
                 parse_file at /home/jayvijay/RailsTestProject/MyFirstRailsProject/config.ru:1
                 parse_file at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/rack-1.4.7/lib/rack/builder.rb:40
                        app at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/rack-1.4.7/lib/rack/server.rb:200
                        app at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/railties-3.2.13/lib/rails/commands/server.rb:46
                wrapped_app at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/rack-1.4.7/lib/rack/server.rb:304
                      start at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/rack-1.4.7/lib/rack/server.rb:254
             block in start at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/railties-3.2.13/lib/rails/commands/server.rb:70
                        tap at org/jruby/RubyKernel.java:1765
                     <main> at /JRuby-9.1.17/jruby-9.1.17.0/lib/ruby/gems/shared/gems/railties-3.2.13/lib/rails/commands.rb:55
                    require at org/jruby/RubyKernel.java:956
                     <main> at script/rails:6

我不知道我要去哪里。 以下是我的database.yml文件

# MySQL.  Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
#   gem install activerecord-jdbcmysql-adapter
#
# Configure Using Gemfile
# gem 'activerecord-jdbcmysql-adapter'
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
  adapter: mysql2
  encoding: utf8
  database: #MyFirstRailsProject_development
  username: username
  password: password
  host: localhost
  port : 3306
  socket: /var/run/mysqld/mysqld.sock

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  encoding: utf8
  database: #MyFirstRailsProject_test
  username: username
  password: password
  host: localhost
  port : 3306
  socket: /var/run/mysqld/mysqld.sock

production:
  adapter: mysql2
  encoding: utf8    
  database: #MyFirstRailsProject_production
  username: username
  password: password
  host: localhost
  port : 3306
  socket: /var/run/mysqld/mysql

My SQL Version is:
mysql  Ver 14.14 Distrib 5.5.61

JRuby版本:

jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9

轨道版本

Rails 3.2.13

宝石文件:

source 'https://rubygems.org'

gem 'rails', '3.2.13'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'activerecord-jdbcmysql-adapter'

gem 'jruby-openssl'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyrhino'

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

请任何人提供建议,我在这里做错了什么? 是JRuby而不是Ruby->(那会有所作为吗?)

0 个答案:

没有答案