0

we are trying to integrate an existing mysql database in our jruby on rails application. Our client provided us with a bare bone rails skeleton, which was not configured for a sepcific database. We were later provided with a sql database and were asked to integerate it in our application using mysql. We started out by creating a database.yml file with the necessairy information. We then executed the rake db:create command, which resulted in following error message below. Any suggestions on what we're doing wrong? We're helpless. Thx in advance.

    $ rake db:create --trace
    rake aborted!
    undefined method `each' for nil:NilClass
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/activerecord-jdbc-adapter-1.2.2/lib/arjdbc/jdbc/jdbc.rake:15:in `redefine_task'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/activerecord-jdbc-adapter-1.2.2/lib/arjdbc/jdbc/jdbc.rake:23:in `(root)'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/task_manager.rb:207:in `in_namespace'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb:102:in `namespace'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/activerecord-jdbc-adapter-1.2.2/lib/arjdbc/jdbc/jdbc.rake:22:in `(root)'
    org/jruby/RubyKernel.java:1052:in `load'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/activerecord-jdbc-adapter-1.2.2/lib/arjdbc/jdbc/jdbc.rake:234:in `load'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:639:in `new_constants_in'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in `load'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/default_loader.rb:6:in `load'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/application.rb:569:in `load_imports'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/application.rb:508:in `raw_load_rakefile'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `load_rakefile'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `run'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/gems/rake-0.9.2.2/bin/rake:33:in `(root)'
    org/jruby/RubyKernel.java:1052:in `load'
    /Users/rath_rio/.rvm/gems/jruby-1.6.6@webgrouper/bin/rake:19:in `(root)'

our system specification: 
Java SE 6
JRuby 1.6.6
Rails 3.1

we use following gems for our datebase:
gem 'mysql2', '~>0.3.0'
gem "jdbc-mysql", "~> 5.1.13"
gem "activerecord-jdbc-adapter", "~> 1.2.2"
gem "activerecord-jdbcmysql-adapter", "~> 1.2.2"

our database.yml file:
development:
    database: webgrouper_development
    adapter: jdbcmysql
    encoding: utf8
    reconnect: true
    pool: 5
    username: root
    password: 
    host: 127.0.0.1

test:
    database: webgrouper_test
    adapter: jdbcmysql
    encoding: utf8
    reconnect: false
    pool: 5
    username: root
    password: 
    host: 127.0.0.1

production:
    database: webgrouper_production
    adapter: jdbcmysql
    encoding: utf8
    reconnect: false
    pool: 5
    username: root
    password: 
    host: 127.0.0.1
0

What I can say so far, having run across this while troubleshooting something else and happening to have the relevant source code up, is that this rake task is dying because it is attempting to iterate over the actions for the current task, but the set of actions is nil.

Understanding exactly what was done wrong in the terse and uncommented code in there is difficult. Something is making this incredibly fragile system break down. I have an odd wild guess. What happens if you put "adapter: jdbcmysql" as the first part of each database stanza in your YML, instead of "database: webgrouper_production"?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.