|
Re: session memory persistence: msg#00083java.enhydra.general
Murphy's law, post an email and you find an answer 3 seconds after you click send. The problem seems to be with the MultiClassLoader. Since Strings and HashMap's are on the system classpath they don't have any problems, but an instance of a user class from one classloader won't match an instance of the exact same class from another classloader. Now I need to find a solution to migrate my session data across class loaders: - put session data classes in system classpath, ick - use reflection to extract data from session data classes and set it on new instances from the new classloader - ? There has to be a cleaner way? On Tue, 2003-02-25 at 14:36, Vaughn Dickson wrote: > 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> |
|---|---|---|
| Previous by Date: | session memory persistence, Vaughn Dickson |
|---|---|
| Next by Date: | Re: XML with enhydra, Howto?, David H. Young |
| Previous by Thread: | session memory persistence, Vaughn Dickson |
| Next by Thread: | setting an event's value for an HTMLElement, Camila Piñeiro |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |