JRuby

Rails migrations fail with: undefined method `create_database' for class `#<Class:01x132c515>'

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    JRuby 1.1, Windows XP SP2, JDK 1.6 Update 3, Rails 1.2.6
  • Number of attachments :
    0

Description

jruby -S rake db:migrate --trace output:

(in C:/Documents and Settings/CynicalRyan/My Documents/Coding/RERPer)

    • Invoke db:migrate (first_time)
    • Invoke environment (first_time)
    • Execute environment
      rake aborted!
      undefined method `create_database' for class `#<Class:01x132c515>'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737:in `in_namespace'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:821:in`namespace'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.8/lib/jdbc_adapter/jdbc.rake:12
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.8/lib/jdbc_adapter/rake_tasks.rb:5
      C:/dev/jruby/1.1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require'
      C:/dev/jruby/1.1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.8/lib/active_record/connection_adapters/jdbc_adapter.rb:8
      C:/dev/jruby/1.1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require'
      C:/dev/jruby/1.1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activerecord-jdbcmysql-adapter-0.8/lib/active_record/connection_adapters/jdbcmysql_adapter.rb:22
      C:/dev/jruby/1.1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in`require'
      C:/dev/jruby/1.1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in`require'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record.rb:81
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record.rb:80:in `each'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record.rb:80
      C:/dev/jruby/1.1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require'
      C:/dev/jruby/1.1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require'
      C:/Documents and Settings/CynicalRyan/MyDocuments/Coding/RERPer/config/../config/environment.rb:17
      C:/dev/jruby/1.1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require'
      C:/dev/jruby/1.1.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/tasks/misc.rake:3
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in`call'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in`execute'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in`each'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in`execute'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in`invoke_with_call_chain'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in`synchronize'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in`invoke_with_call_chain'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:518:in`invoke_prerequisites'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in`each'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1183:in`each'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:515:in`invoke_prerequisites'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:507:in`invoke_with_call_chain'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in`synchronize'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in`invoke_with_call_chain'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in`invoke'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in`invoke_task'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in`top_level'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in`each'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in`top_level'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in`standard_exception_handling'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in`top_level'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in`run'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in`standard_exception_handling'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in`run'
      C:/dev/jruby/1.1.0/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
      C:/dev/jruby/1.1.0/bin/rake:19:in `load'
      C:/dev/jruby/1.1.0/bin/rake:19

Activity

Hide
Stephen Bannasch added a comment -

Hi Philip,

There's not enough info here.

Can you write a set of statements that clearly show the set of minimum prerequisites to generate this error? For example starting with :

jruby -S rails testapp
cd testapp
...

etc.

Show
Stephen Bannasch added a comment - Hi Philip, There's not enough info here. Can you write a set of statements that clearly show the set of minimum prerequisites to generate this error? For example starting with :
jruby -S rails testapp
cd testapp
...
etc.
Hide
Phillip Gawlowski added a comment -

Stephen, that is the minimum number of statements to produce the error.

I JRuby generated a rails app, applied the necessary changes for the adapter as per the JRuby wiki, adn the migration bombs with the above error.

Show
Phillip Gawlowski added a comment - Stephen, that is the minimum number of statements to produce the error. I JRuby generated a rails app, applied the necessary changes for the adapter as per the JRuby wiki, adn the migration bombs with the above error.
Hide
Stephen Bannasch added a comment -

Phillip, I think we mean different things by 'statements' – I mean something I can either run or paste into a shell to easily reproduce a bug. There are many things in your bug which are obvious to you but are only implicit in your bug report.

Browse some of the Jira bug reports to get a.

For example here is a set of statements that can be pasted into a unix shell that will create a testjruby dir, checkout and build jruby 1.1, add JRUBY_HOME/bin to the end of the path, install rails and various other useful gems, create a test rails app, reset the config/database.yml file to use the Java database H2, run script/generate to create a Post resource, and start rails.

I suggest viewing this in Jira – the formatting will be more clear.

To run this on windows you'd need to adapt it – BUT in this case every implicit assumption about how this works is actually explicit at some point ftrom the action of the commands.

mkdir testjruby
cd testjruby
svn co http://svn.codehaus.org/jruby/tags/jruby-1_1 jruby
cd jruby
ant; ant jar-complete; ant create-apidocs
export PATH=$PATH:`pwd`/bin
jruby -S gem install rails mongrel jdbc-mysql jdbc-h2 activerecord-jdbcmysql-adapter activerecord-jdbch2-adapter
cd ..
echo 'PATH=$PATH:`pwd`/jruby/bin' > set_jruby_path
jruby -S rails testrails
cd testrails
echo 'development:
  adapter: jdbch2
  database: <%= RAILS_ROOT %>/db/sds_h2_database' > config/database.yml
jruby script/generate scaffold post name:string body:text
jruby -S rake db:migrate
jruby script/server

If you can adapt this script for Windows you should have a working jruby and rails app AND your non-working setup in another dir – then you can take a look a what are the differences which may be causing the trouble.

FYI: the script: set_jruby_path is just created to make it easier to return to this directory later and to use the version of jruby I installed here by executing: source set_jruby_path.
If you do adapt this script for windows please add it to another comment here. I don't have Windows and I'd like to know what the easiest way to duplicate the function of my script on Windows.

Here's some other info that's useful when making a bug report:

  1. display info about the current JRuby and Java:
    jruby -e 'include Java; puts %Q{Ruby version: JRuby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} rev #{RUBY_PATCHLEVEL})  
    [i386-jruby#{JRUBY_VERSION}]\nplatform: Java, version #{java.lang.System.getProperty("java.version")}}'
  2. display info about the current gem env:
    jruby -S gem env
  3. display info about the actual gems that are installed:
    jruby -S gem list --local

In this testjruby install I just created the results look something like this:

$ jruby -e 'include Java; puts %Q{Ruby version: JRuby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} rev #{RUBY_PATCHLEVEL}) 
[i386-jruby#{JRUBY_VERSION}]\nplatform: Java, version #{java.lang.System.getProperty("java.version")}}'
Ruby version: JRuby 1.8.6 (2008-04-13 rev 6360) [i386-jruby1.1]
platform: Java, version 1.5.0_13

$ jruby -S gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.0.1 (1.0.1)
  - RUBY VERSION: 1.8.6 (2008-04-13 patchlevel 6360) [java]
  - INSTALLATION DIRECTORY: /Users/stephen/dev/testjruby/jruby/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /Users/stephen/dev/testjruby/jruby/bin/jruby
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-java-1.5
  - GEM PATHS:
     - /Users/stephen/dev/testjruby/jruby/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://gems.rubyforge.org"]
  - REMOTE SOURCES:
     - http://gems.rubyforge.org

$ jruby -S gem list --local
*** LOCAL GEMS ***

actionmailer (2.0.2)
actionpack (2.0.2)
activerecord (2.0.2)
activerecord-jdbc-adapter (0.8)
activerecord-jdbch2-adapter (0.8)
activerecord-jdbcmysql-adapter (0.8)
activeresource (2.0.2)
activesupport (2.0.2)
gem_plugin (0.2.3)
jdbc-h2 (1.0.63)
jdbc-mysql (5.0.4)
mongrel (1.1.4)
rails (2.0.2)
rake (0.8.1)
sources (0.0.1)
Show
Stephen Bannasch added a comment - Phillip, I think we mean different things by 'statements' – I mean something I can either run or paste into a shell to easily reproduce a bug. There are many things in your bug which are obvious to you but are only implicit in your bug report. Browse some of the Jira bug reports to get a. For example here is a set of statements that can be pasted into a unix shell that will create a testjruby dir, checkout and build jruby 1.1, add JRUBY_HOME/bin to the end of the path, install rails and various other useful gems, create a test rails app, reset the config/database.yml file to use the Java database H2, run script/generate to create a Post resource, and start rails. I suggest viewing this in Jira – the formatting will be more clear. To run this on windows you'd need to adapt it – BUT in this case every implicit assumption about how this works is actually explicit at some point ftrom the action of the commands.
mkdir testjruby
cd testjruby
svn co http://svn.codehaus.org/jruby/tags/jruby-1_1 jruby
cd jruby
ant; ant jar-complete; ant create-apidocs
export PATH=$PATH:`pwd`/bin
jruby -S gem install rails mongrel jdbc-mysql jdbc-h2 activerecord-jdbcmysql-adapter activerecord-jdbch2-adapter
cd ..
echo 'PATH=$PATH:`pwd`/jruby/bin' > set_jruby_path
jruby -S rails testrails
cd testrails
echo 'development:
  adapter: jdbch2
  database: <%= RAILS_ROOT %>/db/sds_h2_database' > config/database.yml
jruby script/generate scaffold post name:string body:text
jruby -S rake db:migrate
jruby script/server
If you can adapt this script for Windows you should have a working jruby and rails app AND your non-working setup in another dir – then you can take a look a what are the differences which may be causing the trouble. FYI: the script: set_jruby_path is just created to make it easier to return to this directory later and to use the version of jruby I installed here by executing: source set_jruby_path. If you do adapt this script for windows please add it to another comment here. I don't have Windows and I'd like to know what the easiest way to duplicate the function of my script on Windows. Here's some other info that's useful when making a bug report:
  1. display info about the current JRuby and Java:
    jruby -e 'include Java; puts %Q{Ruby version: JRuby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} rev #{RUBY_PATCHLEVEL})  
    [i386-jruby#{JRUBY_VERSION}]\nplatform: Java, version #{java.lang.System.getProperty("java.version")}}'
  2. display info about the current gem env:
    jruby -S gem env
  3. display info about the actual gems that are installed:
    jruby -S gem list --local
In this testjruby install I just created the results look something like this:
$ jruby -e 'include Java; puts %Q{Ruby version: JRuby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE} rev #{RUBY_PATCHLEVEL}) 
[i386-jruby#{JRUBY_VERSION}]\nplatform: Java, version #{java.lang.System.getProperty("java.version")}}'
Ruby version: JRuby 1.8.6 (2008-04-13 rev 6360) [i386-jruby1.1]
platform: Java, version 1.5.0_13

$ jruby -S gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.0.1 (1.0.1)
  - RUBY VERSION: 1.8.6 (2008-04-13 patchlevel 6360) [java]
  - INSTALLATION DIRECTORY: /Users/stephen/dev/testjruby/jruby/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /Users/stephen/dev/testjruby/jruby/bin/jruby
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-java-1.5
  - GEM PATHS:
     - /Users/stephen/dev/testjruby/jruby/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://gems.rubyforge.org"]
  - REMOTE SOURCES:
     - http://gems.rubyforge.org

$ jruby -S gem list --local
*** LOCAL GEMS ***

actionmailer (2.0.2)
actionpack (2.0.2)
activerecord (2.0.2)
activerecord-jdbc-adapter (0.8)
activerecord-jdbch2-adapter (0.8)
activerecord-jdbcmysql-adapter (0.8)
activeresource (2.0.2)
activesupport (2.0.2)
gem_plugin (0.2.3)
jdbc-h2 (1.0.63)
jdbc-mysql (5.0.4)
mongrel (1.1.4)
rails (2.0.2)
rake (0.8.1)
sources (0.0.1)
Hide
Phillip Gawlowski added a comment -

Script:

 
@SET JRUBY_HOME=C:\Program Files\NetBeans 6.0.1\ruby1\jruby-1.1.0\bin
@SET PATH=C:\Program Files\NetBeans 6.0.1\ruby1\jruby-1.1.0\bin

@jruby --version && echo rubygems version: && jruby -S gem --version && echo list of rubygems: && jruby -S gem list -l && jruby -S rake db:migrate --trace

Output:

 
ruby 1.8.6 (2008-03-28 rev 6360) [x86-jruby1.1]
rubygems version: 
1.0.1
list of rubygems: 

*** LOCAL GEMS ***

actionmailer (1.3.6)
actionpack (1.13.6)
actionwebservice (1.2.6)
activerecord (1.15.6)
ActiveRecord-JDBC (0.5, 0.3.2)
activerecord-jdbc-adapter (0.8)
activerecord-jdbcmysql-adapter (0.8)
activesupport (1.4.4)
jdbc-mysql (5.0.4)
jruby-openssl (0.2)
rails (1.2.6)
rake (0.8.1)
RedCloth (3.0.4)
rspec (1.1.3)
rubygems-update (1.1.0)
sources (0.0.1)
warbler (0.9.5)

NetBeans 6.0.1 was used to generate the Rails app (via New Project), with this release: http://dist.codehaus.org/jruby/jruby-bin-1.1.zip as manual update.

config\environment.rb was modified according to this wiki article: http://wiki.jruby.org/wiki/Running_Rails_with_ActiveRecord-JDBC

Gem environment:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.0.1 (1.0.1)
  - RUBY VERSION: 1.8.6 (2008-03-28 patchlevel 6360) [java]
  - INSTALLATION DIRECTORY: C:/Program Files/NetBeans 6.0.1/ruby1/jruby-1.1.0/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: C:/Program Files/NetBeans 6.0.1/ruby1/jruby-1.1.0/bin/jruby.bat.exe
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-java-1.6
  - GEM PATHS:
     - C:/Program Files/NetBeans 6.0.1/ruby1/jruby-1.1.0/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org
Show
Phillip Gawlowski added a comment - Script:
 
@SET JRUBY_HOME=C:\Program Files\NetBeans 6.0.1\ruby1\jruby-1.1.0\bin
@SET PATH=C:\Program Files\NetBeans 6.0.1\ruby1\jruby-1.1.0\bin

@jruby --version && echo rubygems version: && jruby -S gem --version && echo list of rubygems: && jruby -S gem list -l && jruby -S rake db:migrate --trace
Output:
 
ruby 1.8.6 (2008-03-28 rev 6360) [x86-jruby1.1]
rubygems version: 
1.0.1
list of rubygems: 

*** LOCAL GEMS ***

actionmailer (1.3.6)
actionpack (1.13.6)
actionwebservice (1.2.6)
activerecord (1.15.6)
ActiveRecord-JDBC (0.5, 0.3.2)
activerecord-jdbc-adapter (0.8)
activerecord-jdbcmysql-adapter (0.8)
activesupport (1.4.4)
jdbc-mysql (5.0.4)
jruby-openssl (0.2)
rails (1.2.6)
rake (0.8.1)
RedCloth (3.0.4)
rspec (1.1.3)
rubygems-update (1.1.0)
sources (0.0.1)
warbler (0.9.5)
NetBeans 6.0.1 was used to generate the Rails app (via New Project), with this release: http://dist.codehaus.org/jruby/jruby-bin-1.1.zip as manual update. config\environment.rb was modified according to this wiki article: http://wiki.jruby.org/wiki/Running_Rails_with_ActiveRecord-JDBC Gem environment:
RubyGems Environment:
  - RUBYGEMS VERSION: 1.0.1 (1.0.1)
  - RUBY VERSION: 1.8.6 (2008-03-28 patchlevel 6360) [java]
  - INSTALLATION DIRECTORY: C:/Program Files/NetBeans 6.0.1/ruby1/jruby-1.1.0/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: C:/Program Files/NetBeans 6.0.1/ruby1/jruby-1.1.0/bin/jruby.bat.exe
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-java-1.6
  - GEM PATHS:
     - C:/Program Files/NetBeans 6.0.1/ruby1/jruby-1.1.0/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org
Hide
Stephen Bannasch added a comment -

Some differences I noticed:

  1. You don't need: ActiveRecord-JDBC (0.5, 0.3.2) it's obsolete and replaced by
    • activerecord-jdbc-adapter (0.8)
    • activerecord-jdbcmysql-adapter (0.8)
  2. You're using an older version of Rails than I am (1.2.6 => 2.0.2)
  3. You're using mysql and I'm using H2 (though I use mysql all the time in JRuby)

You don't mention modifying config//database.yml (step 7).

Try making a very simple rails app from the command line without using NetBeans by adapting my script above (You don't need the first section : installling jruby and gems). Does that work?

If it does find out what the differences are between that and your NetBeans project.

Show
Stephen Bannasch added a comment - Some differences I noticed:
  1. You don't need: ActiveRecord-JDBC (0.5, 0.3.2) it's obsolete and replaced by
    • activerecord-jdbc-adapter (0.8)
    • activerecord-jdbcmysql-adapter (0.8)
  2. You're using an older version of Rails than I am (1.2.6 => 2.0.2)
  3. You're using mysql and I'm using H2 (though I use mysql all the time in JRuby)
You don't mention modifying config//database.yml (step 7). Try making a very simple rails app from the command line without using NetBeans by adapting my script above (You don't need the first section : installling jruby and gems). Does that work? If it does find out what the differences are between that and your NetBeans project.
Hide
Phillip Gawlowski added a comment -

That I can connect to the DB using JRuby should make it obvious that my DB connection settings are correct (the error message is different when connections fail).

And do you think I would've posted a bug against JRuby / ActiveRecord JDBC if it were an issue with Rails? I'm quite able to differentiate between the two, thank you very much.

The differences are the steps required as per the JRuby wiki article I mentioned (NetBeans generates a defective environment.rb).

And that this is against Rails 1.2.6 is the header of the Bug.

The problem is in some area of JRuby and its infrastructure for Rails, since a JRuby specific switch fixes the issue entirely: http://archive.jruby.codehaus.org/user/47FD6D8D.5020501%40gmail.com

Show
Phillip Gawlowski added a comment - That I can connect to the DB using JRuby should make it obvious that my DB connection settings are correct (the error message is different when connections fail). And do you think I would've posted a bug against JRuby / ActiveRecord JDBC if it were an issue with Rails? I'm quite able to differentiate between the two, thank you very much. The differences are the steps required as per the JRuby wiki article I mentioned (NetBeans generates a defective environment.rb). And that this is against Rails 1.2.6 is the header of the Bug. The problem is in some area of JRuby and its infrastructure for Rails, since a JRuby specific switch fixes the issue entirely: http://archive.jruby.codehaus.org/user/47FD6D8D.5020501%40gmail.com
Hide
Manfred Usselmann added a comment -

I get the same error as Phillip:

/home/manfred/projects/jruby/shoplet> jruby -S rake db:migrate --trace
(in /home/manfred/projects/jruby/shoplet)

    • Invoke db:migrate (first_time)
    • Invoke environment (first_time)
    • Execute environment
      rake aborted!
      undefined method `create_database' for class `#<Class:01x1013985>'
      /opt/jruby-1.1/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737
      /opt/jruby-1.1/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737
      Process jruby exited with code 1
      /opt/jruby-1.1/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737:in `in_namespace'
      /opt/jruby-1.1/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:821:in `namespace'
      /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.8/lib/jdbc_adapter/jdbc.rake:12
      /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load'
      /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load'
      /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in'
      /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load'
      /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.8/lib/jdbc_adapter/rake_tasks.rb:5

Similiar environment: JRuby 1.1, JDK 1.6 Update 3, Rails 1.2.6, but Ubuntu 7.10 instead of Windows XP SP2.

I tried the first example from Ola's book, but used

activerecord-jdbc-adapter (0.8)
activerecord-jdbcmysql-adapter (0.8)

instead of ActiveRecord-JDBC (0.5).

enviroment.rb:
-------------------

if RUBY_PLATFORM =~ /java/
require 'rubygems'
gem 'activerecord-jdbc-adapter'
require 'jdbc_adapter'
end

database.yml:
-------------------

development:
adapter: jdbcmysql
database: shoplet_dev
username: shoplet_dev
password: xxxxxx

Show
Manfred Usselmann added a comment - I get the same error as Phillip: /home/manfred/projects/jruby/shoplet> jruby -S rake db:migrate --trace (in /home/manfred/projects/jruby/shoplet)
    • Invoke db:migrate (first_time)
    • Invoke environment (first_time)
    • Execute environment rake aborted! undefined method `create_database' for class `#<Class:01x1013985>' /opt/jruby-1.1/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737 /opt/jruby-1.1/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737 Process jruby exited with code 1 /opt/jruby-1.1/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1737:in `in_namespace' /opt/jruby-1.1/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:821:in `namespace' /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.8/lib/jdbc_adapter/jdbc.rake:12 /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load' /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load' /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in' /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:488:in `load' /opt/jruby-1.1/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.8/lib/jdbc_adapter/rake_tasks.rb:5
Similiar environment: JRuby 1.1, JDK 1.6 Update 3, Rails 1.2.6, but Ubuntu 7.10 instead of Windows XP SP2. I tried the first example from Ola's book, but used activerecord-jdbc-adapter (0.8) activerecord-jdbcmysql-adapter (0.8) instead of ActiveRecord-JDBC (0.5). enviroment.rb: ------------------- if RUBY_PLATFORM =~ /java/ require 'rubygems' gem 'activerecord-jdbc-adapter' require 'jdbc_adapter' end database.yml: ------------------- development: adapter: jdbcmysql database: shoplet_dev username: shoplet_dev password: xxxxxx
Hide
Nick Sieger added a comment -

See also http://dev.rubyonrails.org/ticket/11596 which might help some of you.

Show
Nick Sieger added a comment - See also http://dev.rubyonrails.org/ticket/11596 which might help some of you.
Hide
Ola Bini added a comment -

I recommend upgrading to the latest version of Rails. The newer releases of the infrastructure is geared towards the latest stable version of Rails, which is 2.0.2. If you're still on 1.2, the mileage may wary.

One possible cause for this problem might be in jdbc.rake, the line if respond_to?(:create_database)
might be replaced with if Rake.application.lookup(:create_database)

Show
Ola Bini added a comment - I recommend upgrading to the latest version of Rails. The newer releases of the infrastructure is geared towards the latest stable version of Rails, which is 2.0.2. If you're still on 1.2, the mileage may wary. One possible cause for this problem might be in jdbc.rake, the line if respond_to?(:create_database) might be replaced with if Rake.application.lookup(:create_database)
Hide
Ola Bini added a comment -

No comments on this. Is it still a problem?

Show
Ola Bini added a comment - No comments on this. Is it still a problem?
Hide
Thomas E Enebo added a comment -

I am resolving this. We have had many releases of JRuby since then and Rails for that matter. Please open a new issue if you are still having a problem.

Show
Thomas E Enebo added a comment - I am resolving this. We have had many releases of JRuby since then and Rails for that matter. Please open a new issue if you are still having a problem.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: