views:

130

answers:

2

I am having problems configuring JRuby to work properly with OpenSSL. Googling has revealed that this is a pretty common occurence, but none of the solutions I've read have 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, require 'openssl' returns true even if I don't have the jruby-openssl gem installed. According to this link, that shouldn't happen?

Trying to load the gem explictly with require 'rubygems' and gem 'jruby-openssl' doesn't help.

A: 

In the few instances that I've used JRuby, I'd head to the community's IRC channel when I ran into problems. The project devs hang out in the room for most of the working day and are very helpful when questions are asked. Check this page out for details.

Dave McClelland
+2  A: 

Are you sure you are looking at 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
banzaiman
Well, now that's interesting. But in my case, the error is coming from a gem, so I'm going to assume that at some point at least this was the correct constant.
Matthew Scharley
@Matthew We are getting this error from the same gem in fact (Redcar). There was a bug that caused this error for me. Once that bug was fixed, I removed the .redcar folder, and reinstalled and everything was fine, so maybe you should give that a shot.
dbyrne
@dbyrne: Yea, it's fixed for me too. Still curious about the fix itself though. Might see if I can get Dan to post here about it.
Matthew Scharley
@Matthew: Here for a description of the problem: http://groups.google.com/group/redcar-editor/browse_thread/thread/b8b1bfdbc8155b92#
dbyrne