logo       

session memory persistence: msg#00082

java.enhydra.general

Subject: session memory persistence

Hi,

I'm using the basic session manager and
"SessionManager.MemoryPersistence = true" and "Server.AutoReload = true"
in my application's config.
If I only keep standard classes such as String, or HashMap in the
SessionData object then this method works, but if I try to use my custom
objects such as User or CashmagicSessionData (which contains a User
object amongst others) then I get a ClassCastException. They do
implement Serializable, but I'm not using PAGE_TO_DISK, so it should'nt
matter.

What's really confusing is that the object being returned from the
session manager after the reload is definitely a CashmagicSessionData or
User object as reflection shows the correct method signatures and the
toStrings match as well, but after the reload the cashmagicSessionData
object is not considered an instanceof CashmagicSessionData anymore,
same with User. Even though doing a getClass().getName() on both objects
returns the correct class.

I've looked at MemoryPersistence and it does nothing magic, so I can't
see how the objects in sessionData are losing their instance
information.

Any pointers would be appreciated. Oh, and if I use PAGE_TO_DISK nothing
gets persisted, but all I need is memory persistence.

Regards,
Vaughn

----transcript of log -----
Creating new User()
INFO: set test
INFO: sessionData = {test=cashmagic.data.User@5a799473}
Creating CashmagicSessionData()
INFO: mySessionData =
cashmagic.presentation.CashmagicSessionData@6ed29473
INFO: instanceof CashmagicSessionData = true
INFO: mySessionData.class = class
cashmagic.presentation.CashmagicSessionData
INFO: sessionData =
{CashmagicSessionData=cashmagic.presentation.CashmagicSessionData@6ed29473,
test=cashmagic.data.User@5a799473}
////// reloads here ///////////
INFO: sessionData =
{CashmagicSessionData=cashmagic.presentation.CashmagicSessionData@6ed29473,
test=cashmagic.data.User@5a799473}
//// get key test from session data and cast to User
ALERT: cashmagic.presentation.ErrorHandler stack trace =
ALERT: java.lang.ClassCastException: cashmagic.data.User
ALERT+ at
cashmagic.presentation.BasePO.initSessionData(BasePO.java:179)
ALERT+ at cashmagic.presentation.BasePO.run(BasePO.java:157)
//// retrieve CashmagicSessionData key
INFO: sessionData =
{CashmagicSessionData=cashmagic.presentation.CashmagicSessionData@6ed29473,
test=cashmagic.data.User@5a799473}
INFO: obj instanceof CashmagicSessionData = false
INFO: obj = cashmagic.presentation.CashmagicSessionData@6ed29473
INFO: obj.class = cashmagic.presentation.CashmagicSessionData


--
Vaughn Dickson <vdickson@xxxxxxxxxx>



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise