tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johan Wasserman - CPX Mngd Services" <>
Subject RE: Session persistance
Date Fri, 16 Apr 2004 06:41:28 GMT
Any luck Anu?
I have exactly the same request...
I need to serialize the session (HttpSession to a byte array) and save
it to a blob in MySql (i use Hibernate).

I have tried, for example;
ByteArrayOutputSream baos = new ByteArrayOutputstream();
ObjectOutputStream oos = new ObjectOutputStream(boas);
oos.writeObject(session);  //<-- it fails here, nothing in the logs
byte[] sessionAsBytes = baos.toByteArray();

I need this to give the user the option to restore a previous session
(where they where before they last logged out, with all the session
variables required to restore to that point). I guess that's what you
need it for as well.

By the way, hibernate's createBlob also doesn't do he trick.  Something
to do with the session.  I'm thinking of creating a bean (and store it
in session) to keep track of my app and then just
serializing/deserializing that bean from/to the session on logout/login.
I prefer the session though.

Thanks, Johan.

-----Original Message-----
From: Anu Mathew [] 
Sent: Friday, April 16, 2004 7:37 AM
To: Tomcat Users List
Subject: Re: Session persistance

I already RTFM. From the manual I understood that you are also part of
developing TFM. But in TFM, restoring of the session is mentioned as
automatic when the applicatio/server restarts. But I want to control
both storing and restoring of the session using my code. Is this
possible? Thanks, Anu Mathew
----- Original Message -----
From: "Shapira, Yoav" <>
To: "Tomcat Users List" <>
Sent: Thursday, April 15, 2004 6:45 PM
Subject: RE: Session persistance

> Hi,
> >I need to
> >1. Store the session object in a database (I can trigger this 
> >operation from a jsp say logoff.jsp ) 2. Retrieve the session object 
> >from the database (I can trigger this operation from a jsp say 
> >login.jsp )
> >
> >Thoughts??
> Here's one thought: RTFM.  JDBC store for sessions: 
> Yoav Shapira
> This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged.  This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an)
intended recipient, please immediately delete this e-mail from your
computer system and notify the sender.  Thank you.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

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

View raw message