27 Sep 2010

JRuby – Rails – Cookie Session Stores

Development No Comments

We are transitioning from Mongrels & Apache to JRuby & Glassfish v3. We use Cookie Session Stores in one of our Ruby on Rails (RoR) projects. They are the default session store and work well for our load-balancing requirements. When we switched to JRuby/Glassfish, our RoR cookie clients were receiving JSESSIONID cookies. Since the RoR session cookies actually store the session data and JSESSIONIDs do not our session load-balancing failed.

There are numerous solutions to load-balancing with Glassfish clusters and special ‘Sticky Glassfish Clusters’. Upon research this seemed to be the most common answer to our trouble, but it introduced more variables into the transition that we did not want to deal with. In the end we set our

 config.action_controller.session_store = cookie_store

and we were back in business. This was a very simple solution to our problem. Hopefully this helps someone else transitioning to JRuby/Glassfish.

No Responses to “JRuby – Rails – Cookie Session Stores”

Leave a Reply