Forum: Ruby on Rails Strange Capistrano deploy error - executing environment.rb?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2007-02-19 20:08
Capistrano 1.4
Source system: Win XP
Target system: Red Hat 10.x

I recently added the following to my environment.rb file in order to use
the Ruby-Java bridge (RJB):

require 'rjb'
gem 'rjb', '>= 1.0.3'
Rjb::load("#{RAILS_ROOT}/lib/jxl.jar", ['-Xmx512M'])

When I deploy to my remote system, when this line in deploy.rb:

  run "cd #{current_path}; rake db:migrate RAILS_ENV=test;"

is executed, I see the following in the log:

executing "cd ~dusan/eSimplyTest/current; rake db:migrate
    servers: [""]
    [] executing command
 ** [out ::] /usr/bin/rake:17:Warning: require_gem is
obsolete.  Use gem instead.
 ** [out ::] (in
 ** [out ::] rake aborted!
 ** [out ::] can't create Java VM
 ** [out ::]
 ** [out ::] (See full trace by running task with --trace)

Notice the "can't create Java VM" line, as though it's attempting to run
the code in environment.rb.  I've verified that this is the problem by
commenting out the Jrb setup lines in environment.rb and redeploying and
not seeing the error anymore.

What's going on here?  Why is a rake db:migrate command attempting to
run environment.rb?

If I run "cd ~dusan/eSimplyTest/current; rake db:migrate
RAILS_ENV=test;" on the target server by hand as the correct user, I
don't see any mention of Java VM, and the migrate proceeeds normally.
Also, if I run a SSH session from my Windows box to the target server
and issue this command, it works fine - I don't see this error.

Does anyone understand why stuff in my environment.rb is affecting my
deployment with Capistrano in this way?

Any insight is appreciated.

Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2007-07-26 08:28
As it turns out, this is due to the fact that the ssh calls do not
execute the regular login script for the user on the remote host.

Adding some statements to set environment variables to allow Java stuff
to work did the trick.

This topic is locked and can not be replied to.