JRuby and Openssl in JAR file


I am trying to accomplish the “single master jar file” using
jruby-complete.jar. Everything is working, save for openssl. I have
attempted to follow these instructions, but to no avail. I wanted to
see if there has been any progress or maybe some other path to get
openssl to load in a jar environment. At this point what I have done is
to follow these instructions:


I have been able to get jruby to load the openssl file but now am facing
this issue:

Exception `LoadError’ at org/jruby/RubyKernel.java:1042 - load error:
openssl – java.lang.StackOverflowError: null

I an unsure as to why this is happening - some recursion somewhere is
probably causing the exception. However, I am not sure as to the fix for
this. I have extracted the contents of the jopenssl.jar into the root
of the jruby-complete.jar and added the openssl and jopenssl folders to
the root - along with the openssl.rb file. I have bouncy-castle-java
in the gems/specifications folder on the root. I have rejarred the
folder structure and got the error above.

I am using jruby-complete.jar version 1.6.7 and jruby-openssl version
0.7.5. Any ideas or help would be greatly appreciated.

I was able to figure this out. All that needs to happen is this:

add your jruby-openssl gem to the root of the jruby-complete.jar - so
that you have /gems and /specifications folders at the root of the

Go into the /gems/jruby-openssl/lib/shared and copy these files/folders
to the root of the jruby-complete.jar:

jopenssl - whole folder
openssl - whole folder
openssl.rb - file

jopenssl.jar - need to extract contents to jruby-complete.jar root.

So now you should have this sort of layout in your jruby-complete.jar


  • gems
    • jruby-openssl
  • jopenssl
    • version.rb
  • openssl
    • dummy.rb
    • dummyssl.rb
    • ssl.rb
    • x509.rb
  • org
    • jruby
      • ext
        • openssl
          • impl - folder
          • x509store - folder
          • … lots of .class files
  • specifications
    • jruby-openssl
  • JopensslService.class
  • openssl.rb

Thats it, openssl should work now!