Forum: JRuby NativeException when connecting to LDAP/Active Directory server, only in WAR

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
40e5e9fe36a1f85166493faac2c17499?d=identicon&s=25 Hirotsugu Asari (Guest)
on 2008-11-15 02:15
(Received via mailing list)
I'm trying to track down this NativeException when a Rails app tries
to connect to an LDAP server (it's an Active Directory server,
actually, if that makes any difference) and search from a WAR.

Here's a way to reproduce this problem minimally:
1. jruby rails ldaptest
2. cd ldaptest
3. Remove ActiveRecord from environment.rb (since we don't need to
connect to a database).
4. warble config
5. config.gems << "jruby-ldap" in warble.rb
6. jruby script/generate controller home index
7. Edit app/controllers/home_controller.rb to define a simple
connection, like so: http://pastie.org/315012

Starting the server with 'script/server', going to '/home/index' will
render the familiar "Find me in ..." template.  This is fine in either
development or production environment.

However, if you create WAR with 'warble' and deploy it, same action
triggers this error: http://pastie.org/315013

I'd appreciate any insight.

Hiro

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2008-11-16 06:02
(Received via mailing list)
Hirotsugu Asari wrote:
> 5. config.gems << "jruby-ldap" in warble.rb
>
> I'd appreciate any insight.

It looks like an LDAP error saying the context is not a DirContext. Does
the jruby-ldap library try to hook up to a specific context right away?
Looks like you're deploying to GlassFish, yes?

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
40e5e9fe36a1f85166493faac2c17499?d=identicon&s=25 Hirotsugu Asari (Guest)
on 2008-11-16 14:11
(Received via mailing list)
On Nov 15, 2008, at 11:02 PM, Charles Oliver Nutter wrote:

>> 4. warble config
>
> It looks like an LDAP error saying the context is not a DirContext.
> Does the jruby-ldap library try to hook up to a specific context
> right away? Looks like you're deploying to GlassFish, yes?
>
> - Charlie

Yes, I'm deploying to GlassFish.  I haven't tried other deployment
methods, because I'm not very familiar with them.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2008-11-16 23:03
(Received via mailing list)
Hirotsugu Asari wrote:
> Yes, I'm deploying to GlassFish.  I haven't tried other deployment
> methods, because I'm not very familiar with them.

Can you boil it down to a simple app and file a JRuby bug? Ideally throw
required gems into vendor and toss it our way.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
5a579b3ae2e98ebcc09403f38a390216?d=identicon&s=25 Matt Burke (Guest)
on 2008-11-17 14:32
(Received via mailing list)
We had a problem similar to this. From what I remember, it had to do
with the way that jruby-ldap picked a context factory. When we deployed
to WebSphere, the default factory that jruby-ldap pulled out of
WebSphere caused exceptions similar to yours. I had figured it was just
because of WebSphere, but evidently it's more common.

Here's the code that I wrote to fix it. http://pastie.org/316793 That
includes the fix (changing the context factory) and some code that dumps
more details about LDAP problems, which was helpful when trying to
figure out why our binds were failing.

Hope that helps,
Matt


Hirotsugu Asari wrote:
> 5. config.gems << "jruby-ldap" in warble.rb
>
> I'd appreciate any insight.
>
> Hiro
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2008-11-17 15:26
(Received via mailing list)
Sounds like a good topic for a wiki page or faq :)

Matt Burke wrote:
>
>> 1. jruby rails ldaptest
>> render the familiar "Find me in ..." template.  This is fine in either
>> To unsubscribe from this list, please visit:
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
40e5e9fe36a1f85166493faac2c17499?d=identicon&s=25 Hirotsugu Asari (Guest)
on 2008-11-20 01:35
(Received via mailing list)
It took me a couple of days, but I did get around to this fix.  And a
fix it was!

Thank you, Matt.

--
Hirotsugu Asari



On Nov 17, 2008, at 7:31 AM, Matt Burke wrote:

>
>> 1. jruby rails ldaptest
>> in either development or production environment.
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.