我通过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