Hi, You have written: "This causes problems with session serialization/deserialization in an OSGI environment." I don't know is it a related problem, but I have the following situation (of course app is running in OSGi environment): I have a page with DataView displaying products list with images. Each product has AjaxLink, when I click this link product should be selected (highlighted). But sometimes after click I have an error with serialization:
Root cause: java.io.StreamCorruptedException: invalid type code: 01 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1356) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at org.apache.wicket.util.lang.Objects.byteArrayToObject(Objects.java:392) at org.apache.wicket.protocol.http.pagestore.AbstractPageStore.deserializePage(AbstractPageStore.java:229) at org.apache.wicket.protocol.http.pagestore.DiskPageStore.getPage(DiskPageStore.java:604) at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.get(SecondLevelCacheSessionStore.java:318) at org.apache.wicket.Session.getPage(Session.java:741) at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:443) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1152) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1248) at org.apache.wicket.RequestCycle.request(RequestCycle.java:489) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343) at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:121) at javax.servlet.http.HttpServlet.service(HttpServlet.java:596) Complete stack: java.lang.RuntimeException: Could not deserialize object using `org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory` object factory at org.apache.wicket.util.lang.Objects.byteArrayToObject(Objects.java:406) at org.apache.wicket.protocol.http.pagestore.AbstractPageStore.deserializePage(AbstractPageStore.java:229) at org.apache.wicket.protocol.http.pagestore.DiskPageStore.getPage(DiskPageStore.java:604) at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.get(SecondLevelCacheSessionStore.java:318) at org.apache.wicket.Session.getPage(Session.java:741) at org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:443) at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:139) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1152) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1248) at org.apache.wicket.RequestCycle.request(RequestCycle.java:489) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:343) Do you have similar problems with serialization/deserialization? PS. The strange thing is that in Firefox this is an undeterministic error but in Opera it occurs every time I've clicked the link. Best regards, Daniel On Nov 21, 2007 10:39 AM, Sebastiaan van Erk <[EMAIL PROTECTED]> wrote: > Hi, > > When Wicket pages are serialized/deserialized to the page store, they > are serialized/deserialized using the IObjectStreamFactory set in the > Objects class, and (in trunk) the DefaultObjectStreamFactory overrides > the resolveClass method of ObjectInputStream to consult the > application's IClassResolver. This is all good. :-) > > But, the problem is the session itself. The ObjectIn/OutputStreams that > the session is serialized to and deserialized from are the ones provided > by the container, which do not use the IObjectStreamFactory. This causes > problems with session serialization/deserialization in an OSGI environment. > > I'm not really deeply into the Wicket code, but it seems to me the only > way to really solve this is to make sure the Wicket session is not > directly put in the HTTP session, but instead of it, a SessionHolder > object with a reference to the Wicket session. The SessionHolder can > have readObject/writeObject methods which just read/write the session as > a byte stream using Objects.byteArrayToObject/objectToByteArray. > > That way, when the Session is deserialized the IClassResolver is > consulted (and if the user provides their own IObjectStreamFactory > implementation, it too is used). > > Any comments? > > Regards, > Sebastiaan > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]