The Artima Developer Community
Sponsored Link

Java Buzz Forum
Redeploy web apps without losing the HTTP session

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Norman Richards

Posts: 396
Nickname: orb
Registered: Jun, 2003

Norman Richards is co-author of XDoclet in Action
Redeploy web apps without losing the HTTP session Posted: Jul 7, 2005 11:35 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Norman Richards.
Original Post: Redeploy web apps without losing the HTTP session
Feed Title: Orb [norman richards]
Feed URL: http://members.capmac.org/~orb/blog.cgi/tech/java?flav=rss
Feed Description: Monkey number 312,978,199
Latest Java Buzz Posts
Latest Java Buzz Posts by Norman Richards
Latest Posts From Orb [norman richards]

Advertisement

The bug fix cycle on a web application can be time consuming. You've worked yourself into the application and found a bug. You fix it and redeploy. The redeploy should be fast, but it can take quite a few clicks to drill into an application far enough to get back to where you were because you usually lose your HTTP session when an application goes away. If your fix is pure JSP, sure you can overwrite your old JSPs and keep working, but fixes are often a bit more complex.

It's always bothered me, but I realized today that using JBossCache for HTTP session replication in JBoss solves this problem. If you run with session replication (add tc5-cluster-service.xml and mark your app as distributable) then your HTTP session is actually preserved on application redeploy even if you only have a single node. If you run into a logic problem, you just need to fix the code and redeploy the app then reload the page. You'll be right where you left off. Very cool.

There are some tricks here. In order to use HTTP session replication, everything that goes into the session needs to be serializable. (this shouldn't need to be true with TreeCacheAOP but with the standard TreeCache that is used now in JBossCache, that is true) This takes a bit of effort and can be a real headache if you haven't been careful about what goes into the session. It can also be a headache if you don't really take care of serialization details like SerialVersionUID. This bit me today when I changed a method on one of my JSF managed beans. JBossCache couldn't restore the session correctly because of the SerialVersionUID mismatch. Woops.

I feel dumb for not realizing this sooner, but I rarely develop an application with clustering on. However, it's so useful that I plan to develop all my applications as distributable, where possible, to take advantage of the longer lived sessions.

Read: Redeploy web apps without losing the HTTP session

Topic: Thoughts on a SOA, part 5: To serialize or not to serialize Previous Topic   Next Topic Topic: iTunes Subcriptions in Feedburner [Flickr]

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use