Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Don't use autload to bring in different session stores #9

Closed
mindscratch opened this Issue · 8 comments

2 participants

@mindscratch

I just ran into an issue starting my JRuby on Rails app (which is deployed as a WAR file to a Tomcat server) that it couldn't load "mongo_mapper". This threw me for a minute b/c I use Mongoid and don't have any direct reference to mongo_mapper.

I found in mongoid_session_store-rails3.rb that autloading was being used (which was added as a pull request on issue #8).

The MongoSessionStore#collection_name= method ultimately ends up referencing the "MongoMapperStore" constant (defined by the autloading setup), which in turn ends up requring 'mongo_mapper', which I don't have installed.

I understand the autoload feature makes things a bit cleaner but it also causes things to break when you don't have all possibly used gems installed.

@mindscratch

This issue only seems to occur when the Rails application is deployed to Tomcat, it seems to not be an issue when running under WEBrick. One thing to note is when the app is deployed to Tomcat its setup to use multiple threads.

@brianhempel
Owner

Thanks for the report! I'll try to have a fix up by the end of the week.

@brianhempel brianhempel referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@brianhempel
Owner

@mindscratch can you test against the jruby_tomcat_fix branch?

gem 'mongo_session_store-rails3', :git => 'git://github.com/brianhempel/mongo_session_store.git', :branch => 'jruby_tomcat_fix'

It's a last ditch attempt to still allow autoloading. If it doesn't work, the autoloading can be reverted.

@mindscratch

@brianhempel this fix did not work

@brianhempel brianhempel reopened this
@brianhempel
Owner

@mindscratch I reverted autoload on the jruby_tomcat_fix branch. If you can confirm that fixes the problem, I'll merge into master and push a new gem version.

@mindscratch

The reverted autoload is working just fine.

@brianhempel
Owner

@mindscratch v3.0.5 pushed to rubygems. Thanks for your feedback!

@mindscratch

@brianhempel no problem, it's always nice to see the open-source process at work :) thanks for the library!

@brianhempel brianhempel closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.