Description of problem: I try to execute the command (java -jar /usr/share/java/jruby.jar -e "puts 'hello'") , returns the this error. But when i try to replace it with logstash's the jruby.jar, it succeeded. ``` # ll /usr/share/java/jruby.jar /usr/share/java/jruby.jar -> ../../../usr/share/jruby/lib/jruby.jar # java -verbose -jar /usr/share/jruby/lib/jruby.jar -e "puts 'hello'" # Failure!! ... [Loaded java.lang.Throwable$WrappedPrintStream from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/rt.jar] [Loaded java.util.IdentityHashMap$KeySet from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/rt.jar] java.lang.NoClassDefFoundError: jnr/posix/JavaSecuredFile at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:760) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.jruby.Main.<init>(Main.java:103) at org.jruby.Main.main(Main.java:197) Caused by: java.lang.ClassNotFoundException: jnr.posix.JavaSecuredFile at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 14 more ... # java -jar /usr/lib64/logstash/vendor/jruby/lib/jruby.jar -e "puts 'hello'" # Succeeded!! hello ``` Version-Release number of selected component (if applicable): java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64 jruby-1.7.2-5.fc21.noarch How reproducible: see following Steps to Reproduce: 1. install logstash # dnf copr enable mosquito/copr # dnf install logstash 2. exec command # java -jar /usr/lib64/logstash/vendor/jruby/lib/jruby.jar -e "puts 'hello'" # java -verbose -jar /usr/share/jruby/lib/jruby.jar -e "puts 'hello'" 3. see output Actual results: java.lang.NoClassDefFoundError: jnr/posix/JavaSecuredFile at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:760) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.jruby.Main.<init>(Main.java:103) at org.jruby.Main.main(Main.java:197) Caused by: java.lang.ClassNotFoundException: jnr.posix.JavaSecuredFile at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 14 more Expected results: hello Additional info: none
jruby.jar normally bundles all its dependencies. However, in Fedora the dependencies are unbundled and system jars are used instead. This means that if you want to use jruby.jar directly, you need to use something like this (the list of dependencies is probably not complete): java -cp `build-classpath jruby objectweb-asm/asm objectweb-asm/asm-commons objectweb-asm/asm-tree objectweb-asm/asm-analysis objectweb-asm/asm-util joni jnr-enxio jnr-x86asm jnr-unixsocket/jnr-unixsocket jnr-posix bytelist jnr-constants jcodings jnr-ffi/jnr-ffi snakeyaml commons-codec base64coder jzlib invokebinder joda-time joda-convert` org.jruby.Main -e "puts 'hello'" The recommended way of achieving the same result would be just calling: jruby -e "puts 'hello'" But unfortunately, jruby in F21 isn't in a very good shape. See bug #1174128.
(In reply to Michal Srb from comment #1) > jruby.jar normally bundles all its dependencies. However, in Fedora the > dependencies are unbundled and system jars are used instead. This means that > if you want to use jruby.jar directly, you need to use something like this > (the list of dependencies is probably not complete): > > java -cp `build-classpath jruby objectweb-asm/asm objectweb-asm/asm-commons > objectweb-asm/asm-tree objectweb-asm/asm-analysis objectweb-asm/asm-util > joni jnr-enxio jnr-x86asm jnr-unixsocket/jnr-unixsocket jnr-posix bytelist > jnr-constants jcodings jnr-ffi/jnr-ffi snakeyaml commons-codec base64coder > jzlib invokebinder joda-time joda-convert` org.jruby.Main -e "puts 'hello'" > > The recommended way of achieving the same result would be just calling: > jruby -e "puts 'hello'" > > But unfortunately, jruby in F21 isn't in a very good shape. See bug #1174128. Thank you for your reply. Command(jruby -e "puts 'hello'") still failed. jruby in fc22 will become stable?
(In reply to sensor.wen from comment #2) > > Thank you for your reply. Command(jruby -e "puts 'hello'") still failed. > jruby in fc22 will become stable? I just checked and jruby in F22 is the same as in F21. I will do some testing and see if it would be possible to merge jruby changes from Rawhide to F22 without breaking other packages depending on it.
jruby-1.7.19-1.fc22 has been submitted as an update for Fedora 22. https://admin.fedoraproject.org/updates/jruby-1.7.19-1.fc22
Package jruby-1.7.19-1.fc22: * should fix your issue, * was pushed to the Fedora 22 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing jruby-1.7.19-1.fc22' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2015-6221/jruby-1.7.19-1.fc22 then log in and leave karma (feedback).
thanks, i will try it.
jruby-1.7.19-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.