Capistrano Issue #1017

Closed
rwilliams opened this Issue Sep 16, 2013 · 7 comments

Projects

None yet

3 participants

@rwilliams

I just started using JRuby head( 815f778 ) up from 1.7.4 and I can no longer deploy my app with Capistrano ( 2.15.5 ).

[deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: xxx.xxx.xxx.xxx (NameError: cannot load Java class jline.console.ConsoleReader)
connection failed for: xxx.xxx.xxx.xxx (NameError: cannot load Java class jline.console.ConsoleReader)
$ ruby -v
jruby 1.7.5.dev (1.9.3p392) 2013-09-16 @jruby.revision@ on Java HotSpot(TM) 64-Bit Server VM 1.6.0_51-b11-457-11M4509 [darwin-x86_64]
@enebo
Member
enebo commented Sep 16, 2013

If you execute this:

jruby -e 'require "readline"; p Java::jline.console.ConsoleReader'

Does it print out the constant or blow up? If it works then I am wondering if something is not require'ing readline before trying to access this lower level Java class?

@rwilliams

@enebo It prints out the constant fine.

@enebo
Member
enebo commented Sep 16, 2013

Ah. So some gem or capistrano is trying to access this class JLine directly and is not loading readline first. At least this is what I think. If you could add a 'require "readline"' as early as possible you can help confirm this is in fact the issue. It should work if done before whenever this class is trying to be imported.

For 1.7.5 we stopped stuffing the classes from jline directly into jruby.jar but instead require the jline jar if you decide to use readline. It is possible we might revert this change for 1.7.5 just to make things less painful, but in the future we will end up making this change.

@rwilliams

I added require 'readline' as the last require to my deploy.rb and it started working again.

@enebo
Member
enebo commented Sep 16, 2013

ok great. So last thing you can do is grep for ConsoleReader through your gems to know which gem is doing this? It might be more desirable to get them to fix this than switch back if it is a gem people frequently update anyways. In any case, we need to know so we can get it fixed for the future.

@rwilliams

$ grep "ConsoleReader" . -r

highline-1.6.19/lib/highline/system_extensions.rb:          java_import 'jline.console.ConsoleReader'
highline-1.6.19/lib/highline/system_extensions.rb:          @java_console = ConsoleReader.new(@input.to_inputstream, @output.to_outputstream)
highline-1.6.19/lib/highline/system_extensions.rb:          java_import 'jline.ConsoleReader'
highline-1.6.19/lib/highline/system_extensions.rb:          @java_console = ConsoleReader.new(@java_input, @java_output)
highline-1.6.19/lib/highline.rb:    # Also, JRuby-1.7's ConsoleReader.readLine() needs to be passed the prompt```
@BanzaiMan BanzaiMan referenced this issue in JEG2/highline Sep 17, 2013
Merged

Require 'readline' on JRuby #94

@BanzaiMan
Member

Closing this one.

@BanzaiMan BanzaiMan closed this Sep 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment