Error while using LDAP for authenticate to user login

Hi,

I am trying to make a simple web-application in which user should be
authenticate by LDAP server for login.
I am getting error while I call the bind of LDAP.
below is my error.

Net::BER::BerError in LoginController#authenticate
unsupported object type: class=universal, encoding=constructed, tag=28
RAILS_ROOT: C:/ruby/rails_apps/ldapapp/config/…

Application Trace | Framework Trace | Full Trace
C:/ruby/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ber.rb:117:in
read_ber' C:/ruby/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:1104:inbind’
C:/ruby/ruby/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:701:in
bind' #{RAILS_ROOT}/lib/ldap_connect.rb:10:inauthenticate’
#{RAILS_ROOT}/app/controllers/login_controller.rb:7:in `authenticate’

Thanks in advance.

Shant