Details
Description
I have approximately this code:
AjaxLink openCloseLink = new AjaxLink("openCloseLink");
openCloseLink.add(new Image("icon", new CompressedResourceReference(MyComponent.class, "icon.gif")));
The openCloseLink gets serialized during normal wicket operations,
which causes a serialization error, see stacktrace below.
My guess: the "cache" field needs to be marked "transient" in
org.apache.wicket.markup.html.CompressedPackageResource$CompressingResourceStream
---- STACKTRACE BELOW!
ERROR - Error serializing object class com.traversetechnologies.dhs.gmo.schemaexporter.page.TestPage [object=[Page class = com.traversetechnologies.dhs.gmo.schemaexporter.page.TestPage, id = 0, version = 0, ajax = 3]]
org.apache.wicket.util.io.SerializableChecker$WicketNotSerializableException: Unable to serialize class: java.lang.ref.SoftReference
Field hierarchy is:
0 [class=com.traversetechnologies.dhs.gmo.schemaexporter.page.TestPage, path=0]
private java.lang.Object org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
private org.apache.wicket.util.lang.Bytes org.apache.wicket.markup.html.form.Form.maxSize[1] [class=org.apache.wicket.markup.html.form.Form, path=0:myform2]
private java.lang.Object org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
private java.lang.Object org.apache.wicket.markup.html.form.FormComponent.validators[1] [class=com.traversetechnologies.dhs.gmo.schemaexporter.page.component.SelectableTree, path=0:myform2:mytree]
private java.lang.Object org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
private java.lang.Object org.apache.wicket.MarkupContainer.children[0] [class=com.traversetechnologies.dhs.gmo.schemaexporter.page.component.SelectableTree$3, path=0:myform2:mytree:allCheck]
final org.apache.wicket.markup.repeater.RefreshingView com.traversetechnologies.dhs.gmo.schemaexporter.page.component.SelectableTree$3.val$rowView [class=com.traversetechnologies.dhs.gmo.schemaexporter.page.component.SelectableTree$2, path=0:myform2:mytree:row]
private java.lang.Object org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
private java.lang.Object org.apache.wicket.MarkupContainer.children[0] [class=org.apache.wicket.markup.repeater.Item, path=0:myform2:mytree:row:19]
private java.lang.Object org.apache.wicket.MarkupContainer.children [class=[Ljava.lang.Object;]
java.lang.Object org.apache.wicket.Component.data[0][1][1] [class=com.traversetechnologies.dhs.gmo.schemaexporter.page.component.SelectableTree$2$2, path=0:myform2:mytree:row:19:openCloseLink]
private java.lang.Object org.apache.wicket.MarkupContainer.children [class=org.apache.wicket.markup.html.image.Image, path=0:myform2:mytree:row:19:openCloseLink:icon]
private final org.apache.wicket.markup.html.image.resource.LocalizedImageResource org.apache.wicket.markup.html.image.Image.localizedImageResource [class=org.apache.wicket.markup.html.image.resource.LocalizedImageResource]
private org.apache.wicket.Resource org.apache.wicket.markup.html.image.resource.LocalizedImageResource.resource [class=org.apache.wicket.markup.html.CompressedPackageResource]
private final org.apache.wicket.util.resource.IResourceStream org.apache.wicket.markup.html.CompressedPackageResource.resourceStream [class=org.apache.wicket.markup.html.CompressedPackageResource$1]
private java.lang.ref.SoftReference org.apache.wicket.markup.html.CompressedPackageResource$CompressingResourceStream.cache [class=java.lang.ref.SoftReference] <----- field that is not serializable
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:349)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:395)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:395)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:395)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:395)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:395)
at org.apache.wicket.util.io.SerializableChecker.checkFields(SerializableChecker.java:618)
at org.apache.wicket.util.io.SerializableChecker.check(SerializableChecker.java:541)
at org.apache.wicket.util.io.SerializableChecker.writeObjectOverride(SerializableChecker.java:687)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
at org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:127)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:322)
at org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1100)
at org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:200)
at org.apache.wicket.protocol.http.pagestore.DiskPageStore.storePage(DiskPageStore.java:814)
at org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.put(SecondLevelCacheSessionStore.java:327)
at org.apache.wicket.Session.requestDetached(Session.java:1391)
at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1097)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1368)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:500)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:387)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:199)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.NotSerializableException: java.lang.ref.SoftReference
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:119)
... 23 more