jruby fails to run with nailgun support

Bug #1676386 reported by Yury Zavarin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
jruby (Ubuntu)
New
Undecided
Unassigned

Bug Description

Hi,

Ubuntu 16.04.1 LTS
jruby=1.7.22-1ubuntu1
nailgun=0.9.1-3

I'm trying to run a ruby script using nailgun:
$ cat x.rb
#!/usr/bin/jruby

puts "Hello, world!"
$
$ jruby --ng-server &
[1] 5600
$ NGServer 0.9.1 started on all interfaces, port 2113.

$ jruby --ng x.rb
java.lang.ClassNotFoundException: ng
 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)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:264)
 at com.martiansoftware.nailgun.NGSession.run(NGSession.java:242)

This is due to the fact that nailgun checks its program name, and cannot be started as "ng" (the symlink in jruby package is named "ng"), only as "ng-nailgun":
$ ls -la /usr/share/jruby/tool/nailgun/ng
lrwxrwxrwx 1 root root 26 Oct 23 2015 /usr/share/jruby/tool/nailgun/ng -> ../../../../bin/ng-nailgun
$ cd /usr/bin/
$ sudo ln -s ng-nailgun ng
$ ng
java.lang.ClassNotFoundException: ng
 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)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:264)
 at com.martiansoftware.nailgun.NGSession.run(NGSession.java:242)
$ ng-nailgun
NailGun v0.9.0
<...>

I don't know if this bug should be addressed to nailgun package or jruby package.
There was a similar bug in nailgun:
https://bugs.launchpad.net/ubuntu/+source/nailgun/+bug/793859

So, there are two options:
1. If it's considered as a bug in nailgun package, then you need to make nailgun able to run without checking the program name.
2. If it's a jruby package bug, then the following actions helped me:
i) Rename symlink to ng-nailgun:
$ cd /usr/share/jruby/tool/nailgun/
$ sudo mv ng ng-nailgun
ii) Using new symlink in jruby exec script:
$ cd
$ diff jruby.fixed_nailgun /usr/share/jruby/bin/jruby
335,336c335,336
< if [ -f $JRUBY_HOME/tool/nailgun/ng-nailgun ]; then
< exec $JRUBY_HOME/tool/nailgun/ng-nailgun org.jruby.util.NailMain $mode "$@"
---
> if [ -f $JRUBY_HOME/tool/nailgun/ng ]; then
> exec $JRUBY_HOME/tool/nailgun/ng org.jruby.util.NailMain $mode "$@"
338c338
< echo "error: ng-nailgun executable not found; run 'make' in ${JRUBY_HOME}/tool/nailgun"
---
> echo "error: ng executable not found; run 'make' in ${JRUBY_HOME}/tool/nailgun"
$ sudo cp jruby.fixed_nailgun /usr/share/jruby/bin/jruby
$ jruby --ng x.rb
Hello, world!
$

Yury Zavarin (tadam)
affects: tomcat7 (Ubuntu) → jruby (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.