08 May 2013, 15:27
Generic-user-small

Owen Murphy (11 posts)

“1.3 Preparing Twitalytics for JRuby” (9)

Running…

$ bundle install --without none

…results in a “Your bundle is complete!” success message.

However the subsequent command…

$ rake db:migrate

…fails with the following output:

$ rake db:migrate
rake aborted!
bad URI(is not URI?): test rake db:migrate

Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
08 May 2013, 15:38
Generic-user-small

Owen Murphy (11 posts)

Running again with the –trace option yields the following output:

$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
rake aborted!
bad URI(is not URI?): test rake db:migrate
C:/Dev/jruby-1.7.3/lib/ruby/1.9/uri/common.rb:176:in `split'
C:/Dev/jruby-1.7.3/lib/ruby/1.9/uri/common.rb:210:in `parse'
C:/Dev/jruby-1.7.3/lib/ruby/1.9/uri/common.rb:747:in `parse'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:59:in `connection_url_to_hash'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:34:in `resolve_string_connection'
org/jruby/RubyHash.java:1139:in `fetch'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:33:in `resolve_string_connection'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:23:in `spec'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:127:in `establish_connection'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activerecord-3.2.3/lib/active_record/railtie.rb:76:in `Railtie'
org/jruby/RubyBasicObject.java:1709:in `instance_eval'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:43:in `run_load_hooks'
org/jruby/RubyArray.java:1613:in `each'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activesupport-3.2.3/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activerecord-3.2.3/lib/active_record/base.rb:721:in `(root)'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activerecord-3.2.3/lib/active_record/railties/databases.rake:1:in `(root)'
org/jruby/RubyProc.java:249:in `call'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/activerecord-3.2.3/lib/active_record/railties/databases.rake:6:in `(root)'
org/jruby/RubyArray.java:1613:in `each'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
C:/Dev/jruby-1.7.3/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
org/jruby/RubyArray.java:1613:in `each'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `invoke_prerequisites'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
C:/Dev/jruby-1.7.3/lib/ruby/1.9/monitor.rb:211:in `mon_synchronize'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
org/jruby/RubyArray.java:1613:in `each'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
C:/Dev/jruby-1.7.3/lib/ruby/gems/shared/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
org/jruby/RubyKernel.java:1046:in `load'
C:/Dev/jruby-1.7.3/bin/rake:23:in `(root)'
Tasks: TOP => db:migrate => db:load_config
08 May 2013, 15:46
Generic-user-small

Owen Murphy (11 posts)

Guys, this one has me completely flummoxed. Has anyone had this issue and worked past it? I’m using JRuby 1.7.3 and have tested with the 1.8 and 1.9 interpreter. I’m on Windows 7 64-bit, but I don’t think this issue is environment specific. It might be version specific though.

The output of my twitalytics bundle install is as follows:

$ bundle install --without none
Resolving dependencies...
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.2.0)
Using activesupport (3.2.3)
Using builder (3.0.0)
Using activemodel (3.2.3)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.2)
Using actionpack (3.2.3)
Using mime-types (1.18)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.4)
Using actionmailer (3.2.3)
Using arel (3.0.2)
Using tzinfo (0.3.32)
Using activerecord (3.2.3)
Using activerecord-jdbc-adapter (1.2.9)
Using activeresource (3.2.3)
Using bundler (1.3.5)
Using coffee-script-source (1.2.0)
Using execjs (1.3.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.6)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.3)
Using coffee-rails (3.2.2)
Using diff-lcs (1.1.3)
Using jdbc-postgres (9.2.1002.1)
Using jdbc-sqlite3 (3.7.2.1)
Using jquery-rails (2.0.1)
Using rails (3.2.3)
Using rspec-core (2.8.0)
Using rspec-expectations (2.8.0)
Using rspec-mocks (2.8.0)
Using rspec (2.8.0)
Using rspec-rails (2.8.1)
Using sass (3.1.15)
Using sass-rails (3.2.4)
Using therubyrhino_jar (1.7.4)
Using therubyrhino (2.0.2)
Using uglifier (1.2.3)
Your bundle is complete!
Gems in the group none were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

I get the same error with the very latest version of the rake gem btw. Any help greatly appreciated.

Thanks, Owen.

09 May 2013, 10:45
Generic-user-small

Owen Murphy (11 posts)

I found out what was wrong here. Page 11 of the book includes the following line:

$ RAILS_ENV=test rake db:migrate

This is a mistake, it should be:

$ RAILS_ENV=test
$ rake db:migrate

If I’d been more experienced in Ruby I would have realised the mistake earlier. Having set RAILS_ENV to the bad value, calls to rake db:migrate will fail.

If RAILS_ENV is not set, then the first call to rake db:migrate works as described in the book. I tripped myself up by reading ahead, setting RAILS_ENV to bad value, and forgetting to unset it when re-doing the chapter. It should work on page 9 as expected, but the typo can trip you up on page 11. I’ll check the paper edition when I get home to see if the typo is only in the e-book.

13 May 2013, 12:34
Jruby-conf-profile-mug_pragsmall

Joe Kutner (80 posts)

The intention here was to run rake db:migrate in the development RAILS_ENV, which is the default if RAILS_ENV is not set. It looks from your error message that it was running in production mode. The way RAILS_ENV is set above will cause it to carry on through all further commands, which is not what we want. You need to either unset RAILS_ENV or run this:

$ RAILS_ENV=development rake db:migrate

sorry for the trouble.

  You must be logged in to comment