Bug 1208901 - [jruby] NoClassDefFoundError: jnr/posix/JavaSecuredFile
Summary: [jruby] NoClassDefFoundError: jnr/posix/JavaSecuredFile
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: jruby
Version: 21
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Mo Morsi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-03 19:03 UTC by sensor.wen
Modified: 2015-04-26 12:45 UTC (History)
4 users (show)

Fixed In Version: jruby-1.7.19-1.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-04-26 12:45:59 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description sensor.wen 2015-04-03 19:03:14 UTC
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

Comment 1 Michal Srb 2015-04-04 09:11:59 UTC
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.

Comment 2 sensor.wen 2015-04-04 17:23:10 UTC
(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?

Comment 3 Michal Srb 2015-04-13 09:09:05 UTC
(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.

Comment 4 Fedora Update System 2015-04-16 09:05:39 UTC
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

Comment 5 Fedora Update System 2015-04-17 18:35:51 UTC
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).

Comment 6 sensor.wen 2015-04-20 15:05:16 UTC
thanks, i will try it.

Comment 7 Fedora Update System 2015-04-26 12:45:59 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.