1

我通过 RVM 在 Ubuntu 机器上使用 Ruby 和 JRuby。

OpenLDAP 通过 Ruby 代码与 Net::LDAP gem 完美地连接并执行 CRUD 操作。

这是代码:

    require 'rubygems'
    require 'net/ldap'


ldap = Net::LDAP.new :host => 'locahost',
     :port => 389,
     :async => 1,
     :keepalive => 1,
     :auth => {
           :method => :simple,
           :username => "cn=admin,dc=test,dc=com",
           :password => "secret"
     }

     puts ldap.bind

当我使用 JRuby 执行相同的代码时,它会引发错误:

$ jruby ldap_test.rb 

ArgumentError: unsupported protocol family `__UNKNOWN_CONSTANT__'
        initialize at org/jruby/ext/socket/RubySocket.java:188
               new at org/jruby/RubyIO.java:847
4

0 回答 0