Bug 1090667 - Exception using closure compiler via Node.js wrapper
Summary: Exception using closure compiler via Node.js wrapper
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: closure-compiler
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zbigniew Jędrzejewski-Szmek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1090189
TreeView+ depends on / blocked
 
Reported: 2014-04-23 22:01 UTC by Tom Hughes
Modified: 2014-04-23 23:57 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-04-23 23:14:30 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tom Hughes 2014-04-23 22:01:29 UTC
Description of problem:

I have just packaged the Node.js wrapper for closure-compiler (BZ#1090187) with the package replacing the bundled jar by a link to the jar from the closure-compiler package.

I'm now packaging another Node.js module that uses the wrapper (BZ#1090189) and we're seeing exceptions from the closure compiler:

Error: Exception in thread "main" java.lang.NoClassDefFoundError: org/kohsuke/args4j/CmdLineException
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
	at java.lang.Class.getMethod0(Class.java:2774)
	at java.lang.Class.getMethod(Class.java:1663)
	at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.kohsuke.args4j.CmdLineException
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	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:425)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	... 6 more

What I've found is that if I download the exact same version from upstream (http://dl.google.com/closure-compiler/compiler-20140110.tar.gz) and use the jar from that then it works - the jar is also nearly twice the size of the one in the closure-compiler rpm.

Version-Release number of selected component (if applicable):

closure-compiler-20140110-2.fc21

Comment 1 Tom Hughes 2014-04-23 23:05:14 UTC
The command that the Node.js wrapper is executing is:

java -jar /usr/lib/node_modules/closure-compiler/lib/vendor/compiler.jar --warning_level QUIET --compilation_level SIMPLE_OPTIMIZATIONS

which is equivalent (via a symbolic link) to:

java -jar /usr/share/java/closure-compiler.jar --warning_level QUIET --compilation_level SIMPLE_OPTIMIZATIONS

both commands abort in the same way for me, with the exception shown above.

Comment 2 Tom Hughes 2014-04-23 23:14:30 UTC
So the issue is that the upstream compiler.jar bundles various things which are separate in Fedora and need to be added to the classpath.

Looks like I need to patch the Node wrapper to invoke closure-compiler properly.

Comment 3 Zbigniew Jędrzejewski-Szmek 2014-04-23 23:57:34 UTC
Yes, the classpath must be included. You can have a look at /usr/bin/closure-compiler for the list, it's rather long. I agree that invoking the binary (script really) directly is better.


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