Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jruby 9.1.15 fails with NameError: cannot load Java class jline.console.ConsoleReader #4889

Closed
petrvalkoun-gooddata opened this issue Dec 8, 2017 · 11 comments

Comments

@petrvalkoun-gooddata
Copy link

@petrvalkoun-gooddata petrvalkoun-gooddata commented Dec 8, 2017

windows 8.1 x64, clean install of JDK-8u152 x64, clean install of jruby 9.1.15 x64. Using gooddata gem (bundle install), running any sript using gooddata gem fails with below error. Works fine in jruby 9.1.13

NameError: cannot load Java class jline.console.ConsoleReader
for_name at org/jruby/javasupport/JavaClass.java:286
get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
block in java_import at uri:classloader:/jruby/java/core_ext/object.rb:49
map at org/jruby/RubyArray.java:2487
java_import at uri:classloader:/jruby/java/core_ext/object.rb:36
initialize_system_extensions at C:/jruby/lib/ruby/gems/shared/gems/highline-1.7.10/lib/highline/system_extensions.rb:21
initialize at C:/jruby/lib/ruby/gems/shared/gems/highline-1.7.10/lib/highline.rb:201

at C:/jruby/lib/ruby/gems/shared/gems/highline-1.7.10/lib/highline/import.rb:11
require at org/jruby/RubyKernel.java:955
require at C:/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
at C:/jruby/lib/ruby/gems/shared/gems/gooddata-0.6.53/lib/gooddata/commands/auth.rb:1
require at org/jruby/RubyKernel.java:955
require at C:/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
block in (root) at C:/jruby/lib/ruby/gems/shared/gems/gooddata-0.6.53/lib/gooddata/commands/auth.rb:7
each at org/jruby/RubyArray.java:1735
at C:/jruby/lib/ruby/gems/shared/gems/gooddata-0.6.53/lib/gooddata/commands/commands.rb:1
require at org/jruby/RubyKernel.java:955
(root) at C:/jruby/lib/ruby/gems/shared/gems/gooddata-0.6.53/lib/gooddata/commands/commands.rb:11
at C:/jruby/lib/ruby/gems/shared/gems/gooddata-0.6.53/lib/gooddata/commands/commands.rb:10
require at org/jruby/RubyKernel.java:955
(root) at uri:classloader:/jruby/kernel/kernel.rb:1
at scripts\create_service_project.rb:3

@mkristian
Copy link
Member

@mkristian mkristian commented Dec 8, 2017

@headius this indicates we break existing code when we repackage jline. so all we can do is just shade it.

this is the code line:
https://github.com/JEG2/highline/blob/1-7-stable/lib/highline/system_extensions.rb#L21

@headius
Copy link
Member

@headius headius commented Dec 8, 2017

I think it would be best for us to work with @JEG2 @abinoam et al to either eliminate this hack or provide a blessed way to do it in jruby-readline. If we remove the relocation we'll go back to having issues with jruby-complete usage and other embedding cases.

@jboler
Copy link

@jboler jboler commented Jan 14, 2018

Is there a work around for this?

@mkristian
Copy link
Member

@mkristian mkristian commented Jan 14, 2018

@jboler upgrade highline to the latest version, as the latest works now. not sure if such an upgrade is always possible.

@nelsnelson
Copy link

@nelsnelson nelsnelson commented Jan 24, 2018

I can't seem to use phusion passenger because of this.

$ jruby --version
jruby 9.1.15.0 (2.3.3) 2017-12-07 929fde8 OpenJDK 64-Bit Server VM 25.151-b12 on 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12 +jit [linux-x86_64]
$ passenger --version
Phusion Passenger 5.1.12
$ sudo /usr/bin/passenger-config validate-install
NameError: cannot load Java class jline.console.ConsoleReader
                    for_name at org/jruby/javasupport/JavaClass.java:286
             get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
        block in java_import at uri:classloader:/jruby/java/core_ext/object.rb:49
                         map at org/jruby/RubyArray.java:2487
                 java_import at uri:classloader:/jruby/java/core_ext/object.rb:36
  <class:TerminalChoiceMenu> at /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/terminal_choice_menu.rb:220
[...]
@jboler
Copy link

@jboler jboler commented Jan 24, 2018

@nelsnelson My work around for that was to delete java_import 'jline.console.ConsoleReader' at terminal_choice_menu.rb:220

@headius
Copy link
Member

@headius headius commented Jan 24, 2018

@mkristian So we should disable relocating the jline logic then, yes? Can you undo that for 9.1.16.0 please?

@headius headius added this to the JRuby 9.1.16.0 milestone Jan 24, 2018
@mkristian
Copy link
Member

@mkristian mkristian commented Jan 26, 2018

@headius we fixed a similar problem with the highline gems, maybe we can do this on phusion_passenger. will ping you one irb/gitter the next days. we always can roll back

@headius
Copy link
Member

@headius headius commented Feb 12, 2018

@mkristian Decision time!

@headius
Copy link
Member

@headius headius commented Feb 13, 2018

Ok, after messing with this a bit more it turns out the relocation is just not going to work. The Kernel32 class in jline has JNI methods that can't be located if the class is relocated.

@mkristian will look at removing the relocation and loading the jar through a different mechanism to avoid issues. Then we'll try to finally drop jline in 9.2.

@headius
Copy link
Member

@headius headius commented Feb 20, 2018

This has been fixed for 9.1.16.0.

@headius headius closed this Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.