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.7.0 fails to start on Java 9 #4558

Closed
jordansissel opened this issue Apr 7, 2017 · 4 comments
Closed

JRuby 9.1.7.0 fails to start on Java 9 #4558

jordansissel opened this issue Apr 7, 2017 · 4 comments
Milestone

Comments

@jordansissel
Copy link
Contributor

Environment

  • JRuby: jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae OpenJDK 64-Bit Server VM 9-Debian+0-9b161-1 on 9-Debian+0-9b161-1 +jit [linux-x86_64]
  • Java: OpenJDK 64-Bit Server VM (build 9-Debian+0-9b161-1, mixed mode)

Other environmentals:

Docker image "openjdk:9-jdk" (shortest path for me to try Java 9)

Reproducing.

# ruby -e 'puts "Hello"'

Result:

2017-04-07T02:25:41.459Z [main] ERROR JavaProxyClassFactory : could not use ClassLoader.defineClass method
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @396a51ab
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:335)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:278)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:196)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:190)
        at org.jruby.javasupport.proxy.JavaProxyClassFactory$1.run(JavaProxyClassFactory.java:219)
        at org.jruby.javasupport.proxy.JavaProxyClassFactory$1.run(JavaProxyClassFactory.java:212)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at org.jruby.javasupport.proxy.JavaProxyClassFactory.<clinit>(JavaProxyClassFactory.java:212)
        at org.jruby.javasupport.proxy.JavaProxyClass.<clinit>(JavaProxyClass.java:89)
        at org.jruby.javasupport.Java.createJavaModule(Java.java:163)
        at org.jruby.javasupport.Java.load(Java.java:103)
        at org.jruby.runtime.load.LoadService.reflectedLoad(LoadService.java:590)
        at org.jruby.ext.LateLoadingLibrary.load(LateLoadingLibrary.java:48)
        at org.jruby.runtime.load.LibrarySearcher$FoundLibrary.load(LibrarySearcher.java:34)
        at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:887)
        at org.jruby.runtime.load.LoadService.smartLoadInternal(LoadService.java:527)
        at org.jruby.runtime.load.LoadService.require(LoadService.java:398)
        at org.jruby.ext.jruby.JRubyLibrary.load(JRubyLibrary.java:57)
        at org.jruby.runtime.load.LoadService.reflectedLoad(LoadService.java:590)
        at org.jruby.ext.LateLoadingLibrary.load(LateLoadingLibrary.java:48)
        at org.jruby.runtime.load.LibrarySearcher$FoundLibrary.load(LibrarySearcher.java:34)
        at org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:887)
        at org.jruby.runtime.load.LoadService.smartLoadInternal(LoadService.java:527)
        at org.jruby.runtime.load.LoadService.require(LoadService.java:398)
        at org.jruby.Ruby.init(Ruby.java:1203)
        at org.jruby.Ruby.newInstance(Ruby.java:334)
        at org.jruby.Main.internalRun(Main.java:271)
        at org.jruby.Main.run(Main.java:232)
        at org.jruby.Main.main(Main.java:204)
NameError: missing class or uppercase package name (`java.lang.String'), caused by Unable to make public int java.lang.String$CaseInsensitiveComparator.compare(java.lang.String,java.lang.String) accessible: module java.base does not "opens java.lang" to unnamed module @396a51ab
   method_missing at org/jruby/javasupport/JavaPackage.java:259
     <class:Ruby> at file:/usr/local/rvm/rubies/jruby-9.1.7.0/lib/jruby.jar!/jruby/jruby.rb:43
  singleton class at file:/usr/local/rvm/rubies/jruby-9.1.7.0/lib/jruby.jar!/jruby/jruby.rb:42
   <module:JRuby> at file:/usr/local/rvm/rubies/jruby-9.1.7.0/lib/jruby.jar!/jruby/jruby.rb:2
           <main> at file:/usr/local/rvm/rubies/jruby-9.1.7.0/lib/jruby.jar!/jruby/jruby.rb:1
@jordansissel
Copy link
Contributor Author

jordansissel commented Apr 7, 2017

Workaround: Add some --add-opens flags:

% ruby -J--add-opens=java.base/{java.lang,java.security,java.util,java.security.cert}=ALL-UNNAMED -e 'puts 123'
123

So far at least 4 packages need to be added for opens. Possibly more I haven't found yet.

@jordansissel jordansissel mentioned this issue Apr 7, 2017
2 tasks
@iignatev
Copy link
Contributor

there is a new introduced --permit-illegal-access Java option which relax access checks, so you still can setAccessible, JVM will also prints warnings, so you are able to track your illegal access.

please be informed that the option will be removed in JDK 10, hence it an be used only as an indeed temporary workaround.

@headius
Copy link
Member

headius commented Apr 19, 2017

JRuby 9.1.8.0 should start up fine on Java 9, though for this example there's obviously some rogue output (stty?):

$ rvm jruby-9.1.8.0 do ruby -e 'puts "hello"'
speed 38400 baud; line = 0;
-brkint -imaxbel iutf8
hello

I'll look into that output separately.

@headius headius modified the milestones: JRuby 9.1.9.0, JRuby 9.1.8.0 Apr 19, 2017
@headius
Copy link
Member

headius commented Apr 19, 2017

JRuby master does not appear to have the stty output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants