DirectJRubyEmbedding を使用して、アプリケーションの Java-to-Ruby API 呼び出しを設定しようとしています。ロードする必要のある ruby モジュールの 1 つは、active_support です。次に、「securerandom」をロードし、次に「openssl」をロードします
openssl 内では、digest.rb がこれに関連しています。
OpenSSL gem を使用しようとすると、次のエラーが発生します。
初期化されていない定数 OpenSSL::Digest::OPENSSL_VERSION_NUMBER
org.jruby.RubyModule.const_missing(org/jruby/RubyModule.java:2677) で RUBY.Digest(/Users/v/.rvm/gems/ruby-1.9.3-p125/gems/jruby-openssl-0.8. 2/lib/1.9/openssl/digest.rb:24) RUBY.OpenSSL(/Users/v/.rvm/gems/ruby-1.9.3-p125/gems/jruby-openssl-0.8.2/lib/1.9) /openssl/digest.rb:22) RUBY.(ルート)(/Users/v/.rvm/gems/ruby-1.9.3-p125/gems/jruby-openssl-0.8.2/lib/1.9/openssl/ digest.rb:21) at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027) at RUBY.(root)(/Users/v/.rvm/gems/ruby-1.9.3-p125/ gems/jruby-openssl-0.8.2/lib/1.9/openssl.rb:1) org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027) at RUBY.(root)(/Users/v /.rvm/gems/ruby-1.9.3-p125/gems/jruby-openssl-0.8.2/lib/1.9/openssl.rb:20) org.jruby.RubyKernel.require(org/jruby/RubyKernel.java) :1027) RUBY.(ルート)(/Users/v/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.9/securerandom.rb:1) org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027) at RUBY.(root)(/Users/v/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.9/ securerandom.rb:37) at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027) at RUBY.(root)(/Users/v/.rvm/gems/ruby-1.9.3-p125/ gems/activesupport-3.2.9/lib/active_support.rb:1) org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027) at RUBY.(root)(/Users/v/.rvm/ gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/lib/active_support.rb:24) org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027) at RUBY.(ルート) )(/Users/v/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/lib/active_support/all.rb:1)(ルート)(/Users/v/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/lib/active_support.rb:1) org.jruby.RubyKernel.require(org/jruby) /RubyKernel.java:1027) RUBY で (ルート)(/Users/v/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/lib/active_support.rb:24) 組織で.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027) RUBY.(ルート)(/Users/v/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/) lib/active_support/all.rb:1)(ルート)(/Users/v/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/lib/active_support.rb:1) org.jruby.RubyKernel.require(org/jruby) /RubyKernel.java:1027) RUBY で (ルート)(/Users/v/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/lib/active_support.rb:24) 組織で.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1027) RUBY.(ルート)(/Users/v/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/) lib/active_support/all.rb:1)
次の gem ロードに見られるように、openssl 0.8.2 で Ruby 1.9.3-p125 を使用しています。
.rvm/gems/ruby-1.9.3-p125/gems/jruby-openssl-0.8.2/lib/1.9
私はjirbが示していることに気付きました:
1.9.3-p125 :004 > OpenSSL::OPENSSL_VERSION_NUMBER => 9469999
したがって、JRuby.jar の Java コンパイル済みクラスが OpenSSL モジュールで定義しているように見えますが、.rb ファイルのコードはそれを見つけることができません。
どんな助けでも大歓迎です。
ありがとう