Skip to content
This repository

JRuby 1.7.5 doesn't compile valid class files #1136

Closed
rtyler opened this Issue · 5 comments

2 participants

R. Tyler Croy Charles Oliver Nutter
R. Tyler Croy

I'm hoping this isn't a warbler-based bug, but given the stack trace, I'm assuming it has more to do with the JRuby 1.7.5 compiler.

Under 1.7.4 bundle exec warble jar:clean gemjar compiled runnable jar will create a properly runnable jar file.

Under 1.7.5, a jar-file will be created, but upon running it, the following exception will be raised:

-> % java -jar smb-full.jar -T
Exception in thread "main" java.lang.ClassFormatError: Extra bytes at the end of class file JarMain
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

Looks like this issue might be the underlying reason for the exception.

FWIW, using:

-> % java -version
java version "1.7.0_40"
OpenJDK Runtime Environment (IcedTea 2.4.1) (suse-8.18.1-x86_64)
OpenJDK 64-Bit Server VM (build 24.0-b50, mixed mode)
``
Charles Oliver Nutter
Owner

Damn, I saw this issue once recently and can't remember what caused it. I'll investigate.

R. Tyler Croy

If there's anything you need help with in terms of hunting it down, find me on the IRC channel, I'll be around :)

Charles Oliver Nutter
Owner

If you can provide simple steps to build an app this way (I have not used this feature of warbler in a long time) I can try to reproduce here.

I did find a couple other JRuby issues indicating that conflicts with certain versions of the ASM bytecode library could be to blame.

Also this: jruby/warbler#196

And this one claims to fix the problem in warbler: jruby/warbler#197

R. Tyler Croy

@headius Unfortunately, besides giving you access to a proprietary codebase, I can't really reproduce this This does occur on 1.7.6 as well as 1.7.5 though

I'll try to run warbler from HEAD to see if it generates a good jar file.

R. Tyler Croy

As far as I can tell, this has been corrected as of warbler in 1.4.0 which was recently released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.