JRuby OpenSSL错误 [英] JRuby OpenSSL Error

查看:130
本文介绍了JRuby OpenSSL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在配置JRuby以正确使用OpenSSL时遇到问题。谷歌搜索显示,这是一个相当常见的事件,但我读过的解决方案都没有为我工作。这里是我的设置:


  • Ubuntu 9.10

  • jruby 1.5.1

  • jruby-openssl(0.7)


这是错误:

  irb(main):001:0>需要'jruby / openssl / gem_only'
=> true
irb(main):002:0>要求'openssl'
=> true
irb(main):003:0> OpenSSL :: Digest :: OPENSSL_VERSION_NUMBER
NameError:未初始化的常量OpenSSL :: Digest :: OPENSSL_VERSION_NUMBER

有趣的是,即使我没有安装jruby-openssl gem, require'openssl'也会返回true。根据这个链接,这不应该发生?



<试着用 require'rubygems' gem'jruby-openssl'来加载gem并没有帮助。

解决方案

你确定你正在寻找合适的常量?

  $ 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:未初始化的常量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™64位服务器VM 1.6.0_20)[x86_64-java]
9469999


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.

解决方案

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

这篇关于JRuby OpenSSL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆