tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: sessions lost after redeploy
Date Fri, 06 Feb 2009 18:41:39 GMT
Hash: SHA1


J Robert Ray wrote:
> Hello, I have an app running in tomcat 6.0.18, using the default
> session manager.
> If I stop and start tomcat, or if I use the "reload" button in the
> manager, my sessions are preserved.

Good. That suggests your session data is properly serializable.

> But if I copy a new .war into webapps, or touch the existing .war, so
> that my app redeploys, my sessions are deleted.

Are you sure that simply 'touch'ing the existing WAR causes your
sessions to die? I can't account for that, but...

If you recompile a class, the compiler assigns it a new serialVersionID
(unless you specify one). If you have an object of a class (say, that was serialized with version X before the restart, and
the class in the running server after the restart has version Y, then
the object is not compatible and the de-serialization will fail. Are you
getting any error messages? ClassCastException? Some weird versioning
error? I have forgotten what the JVM says when these error occur...
though the persistent session manager might ignore those errors.

> Is this expected behavior? It would speed up my development cycle if I
> could deploy a new build of the app without having to re-login to the
> app in the browser.

You could explicitly version the classes whose objects you store in the
session. Google for serialVersionID to see how to do this. But if your
objects really are incompatible, it's going to fail, anyway.

Good luck,
- -chris
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message