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]
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?
@enebo It prints out the constant fine.
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.
I added require 'readline' as the last require to my deploy.rb and it started working again.
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.
$ 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```
Closing this one.