aspose file tools*
The moose likes Tomcat and the fly likes Persisting Sessions to Database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Persisting Sessions to Database" Watch "Persisting Sessions to Database" New topic
Author

Persisting Sessions to Database

Nathan Hook
Ranch Hand

Joined: Jan 10, 2005
Posts: 81
The company I am working for is trying to get our application to Enterprise strength and have been working on server failover issues. I've never had to solve a solution like this before and was hoping for some advice.

As of right now I'm not a fan of the current clustering solution that is offered by tomcat and have decided to try and use the PersistentManager/JDBCStore solution.

Please see the following link for an example:

http://www.ingrid.org/jajakarta/tomcat/tomcat-4.0b5/src/catalina/docs/JDBCStore-howto.html

Unfortuanantly using the PersistentManager the HttpSession gets written to the database about 10 to 15 seconds after a new HttpSession gets created.

We wrote a custom HttpSessionAttributeListener that listens for the one attribute we actually store in our HttpSession and when we receive that event we persist the session to the Database.

Will this solution work for server failover for an Enterprise system?

I like this solution because in theory we don't have to ever worry about adding clustering to the server.xml and in theory we don't ever have to worry about bringing down a server or set of servers if we need to.

Thank you for your time.
Kaustabh Singha Roy
Ranch Hand

Joined: Oct 04, 2005
Posts: 43
I have doubt how useful the Listener concept will be in case of a server failure. The listener too in running under the server and when the server itself is not stable then...

Sorry don't have much to contribute.
 
 
subject: Persisting Sessions to Database