Forum: JRuby Disappearing lib

Posted by Avram Dorfman (avramd)
on 2010-08-15 16:38
Hello all,

My earlier problem with Rails 3 and the jruby-ldap lib was
mis-diagnosed. It turns out that what is happening is that after the
first request to the app, the library is somehow disappearing -
everything it defines is no longer defined starting with the second
request to the app.

This happens with a completely vanilla test app with minimum possible
code. All I have done is:

routes.rb:
Jldap::Application.routes.draw do
  match 'foo/:id' => 'foo#index'
end

foo_controller.rb:
require 'ldap'
class FooController < ApplicationController
  def index
    render :text => "authenticated: #{authenticated?() ? 'true' :
'false'}"
  end
  def authenticated?
    $PORT =    ::LDAP::LDAP_PORT
  end
end

Gemfile:
gem 'jdbc-sqlite3'#, :require => 'sqlite3'
gem 'activerecord-jdbcsqlite3-adapter'
gem 'jruby-ldap'

And then launch the app and go to http://localhost/foo/sally.

The first time it executes to completion. After that, it says:

   uninitialized constant LDAP

I apologize for re-posting. This seemed different enough that it was
worth attracting the attention of people who may have had no interest in
the original thread. I am wondering if this is a bug in the bundler in
Rails 3, which I know next to nothing about.

Here is a (trimmed) output of my bundles:

> jruby -S bundle show
Gems included by the bundle:
  * abstract (1.0.0)
  * actionmailer (3.0.0.rc)
  * actionpack (3.0.0.rc)
  * activemodel (3.0.0.rc)
  * activerecord (3.0.0.rc)
  * activerecord-jdbc-adapter (0.9.7)
  * activerecord-jdbcsqlite3-adapter (0.9.7)
  * activeresource (3.0.0.rc)
  * activesupport (3.0.0.rc)
  * builder (2.1.2)
  * bundler (1.0.0.rc.1)
  * jdbc-sqlite3 (3.6.3.054)
  * jruby-ldap (0.0.1)
  * rack (1.2.1)
  * rack-mount (0.6.9)
  * rack-test (0.5.4)
  * rails (3.0.0.rc)
  * railties (3.0.0.rc)
  * rake (0.8.7)
>

I'd appreciate any help or advice.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.