0

I looked everywhere and I can't find any help on how to get JRuby to work on AIX. I tried unpacking the binary package, tried using the jruby-complete.jar but I stumble on the same problems.

All errors seem to occur because JRuby is looking in the wrong directories for lib files.

For instance, I set my GEM_PATH=/home/dev999/install_tmp/gem and then I try to require activerecord-jdbc-adapter, which is installed under ./gem/gems/activerecord-jdbc-adapter-1.3.12, but for some reason JRuby keeps looking for the gem under ./gem/gems/activemodel-4.1.8/lib as shown below.

dev-host:/home/dev999/install_tmp$ jruby -e "require 'activerecord-jdbc-adapter'"
Errno::ENOENT: ENOENT - /home/dev999/install_tmp/gem/gems/activemodel-4.1.8/lib/activerecord-jdbc-adapter
                      file? at org/jruby/RubyFileTest.java:131
  contains_requirable_file? at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/basic_specification.rb:46
                       any? at org/jruby/RubyEnumerable.java:1473
  contains_requirable_file? at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/basic_specification.rb:46
                       any? at org/jruby/RubyEnumerable.java:1473
  contains_requirable_file? at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/basic_specification.rb:44
      find_inactive_by_path at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/specification.rb:898
                       find at org/jruby/RubyEnumerable.java:592
      find_inactive_by_path at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/specification.rb:897
               try_activate at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems.rb:183
                    require at /usr/local/jruby-1.7.16.1/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:132
                     (root) at -e:1

Any insights on what may be causing this are greatly appreciated.

EDIT: The server is an AIX 64 bits; we tried Java 1.6 and 1.7 both 64 and 32 bits (IBM custom build for AIX) but we ended up sticking with 1.7 64 bits in the final solution, although the version doesn't seem to affect the issues found in the Ruby 1.7.9 installation, but since we couldn't get JRuby 1.7.16 to work, I can't be sure if the Java builds we used could have played part in the problem.

hgorni
  • 91
  • 1
  • 6
  • If you can still edit the question, can you add which AIX and which Java you are using? – pedz Nov 21 '14 at 15:00

2 Answers2

1

OK, so the server admin and I spent two days trying to figure these things out and I can finally summarize the solution we ended up with to get JRuby working on AIX_64.

1 . First and most important of all, I had to install JRuby 1.7.9 since the 1.7.16 stable version from the main download page in jruby.org has many (seemingly AIX specific) bugs that we could not figure out; for instance, the wrong gem path resolution shown in my original question. Version 1.7.9 sorts out most of the issues automatically;

2) For some weird reason that I'm still unable to figure out, jirb won't work with the jline-2.11.jar lib that comes with the downloaded JRuby package. At some point I got it to work but then I could not retrace my steps so I gave up. To sort this issue out I downloaded jline-1.0.jar and replaced the jline jar located under <jruby_path>/lib/ruby/shared/readline/jline-2.11.jar; please note that even if we are replacing this with jline-1.0, the jar file name must still be the same i.e. jline-2.11.jar otherwise jirb will complain about a missing lib;

3) Some common steps: add jruby/bin to $PATH; make sure which java shows the correct Java version you want to use; set $JAVA_HOME;

4) (Optional, but very useful) in order to avoid having to grant my user write access to the /usr/<jruby>/<gem_paths> directories but still allow me to install gems without having to ask the admin I added export GEM_PATH=~/.gem to my .profile, then mkdir ~/.gem. To install gems to my home directory I do jgem install <gem_name> -i $GEM_PATH.

Hopefully this helps other users struggling with the same problems.

hgorni
  • 91
  • 1
  • 6
0

My main suggestion is to join the jruby mailing list and ask there. I've used jruby just once and managed to get it working. Here is a bit of magic that I don't really understand that I have at the top of one of the first files I require:

# We need the db2j.jar loaded
require 'db2j.jar'

# Some feaking magic Java needs
Java::JavaClass.for_name 'com.ibm.db2j.jdbc.DB2jDriver'

# The connection string is jdbc:db2j:the/path/to/the/file where the
# file is actually a directory.
CloudscapeDriver = 'jdbc:db2j'

You can see the email thread here: http://comments.gmane.org/gmane.comp.lang.jruby.user/17856

good luck

pedz
  • 2,271
  • 1
  • 17
  • 20
  • Thanks for the suggestion. I can get everything to work on my Linux, OSX and Windows box. But I can't get the installation to work on AIX. It's not just the activerecord-jdbc-adapter gem; it's with any gem. I'll follow your suggestion about the mailing list though. Thanks! – hgorni Nov 21 '14 at 12:36
  • Ah. I misunderstood. So this IS more of an AIX question. Can you tell me what is org/jruby/RubyFileTest.java:131 doing? Perhaps add a bit of debug at that point? – pedz Nov 21 '14 at 14:58