rubyemerite
rubyemerite

Reputation: 382

How to use Net::LDAP with JRuby

I am using Ruby and JRuby on a Ubuntu machine through RVM.

OpenLDAP is connecting and doing the CRUD operation through Ruby code with the Net::LDAP gem perfectly.

Here is the code:

    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

When I execute the same code with JRuby, it throws an error:

$ 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

Upvotes: 1

Views: 190

Answers (0)

Related Questions