JRuby OpenSSL Error

I'm having trouble setting up JRuby to work properly with OpenSSL. Googling showed that this is a fairly common occurrence, but none of the solutions I read worked for me. Here is my setup:

  • Ubuntu 9.10
  • jruby 1.5.1
  • jruby-openssl (0.7)

Here is the error:

irb(main):001:0> require 'jruby/openssl/gem_only'
=> true
irb(main):002:0> require 'openssl'
=> true
irb(main):003:0> OpenSSL::Digest::OPENSSL_VERSION_NUMBER
NameError: uninitialized constant OpenSSL::Digest::OPENSSL_VERSION_NUMBER

Interestingly, it require 'openssl'returns true even if I don't have jruby-openssl gem installed. According to this link , this should not be?

Attempting to load the gem using require 'rubygems'and gem 'jruby-openssl'does not work.

+5
source share
1 answer

Are you sure you are looking for the right constant?

$ ruby -v -r openssl -e 'p OpenSSL::Digest::OPENSSL_VERSION_NUMBER'
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
-e:1: uninitialized constant OpenSSL::Digest::OPENSSL_VERSION_NUMBER (NameError)

$ ruby -v -r openssl -e 'p OpenSSL::OPENSSL_VERSION_NUMBER'
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
9470159

$ jruby -v -r openssl -e 'p OpenSSL::OPENSSL_VERSION_NUMBER'
jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_20) [x86_64-java]
9469999
+3
source

All Articles