错误序列化Wicket中的对象

时间:2017-12-07 17:30:38

标签: java wicket

我正在使用Wicket 7.9.0。

我在从文件系统加载的页面上有一个图像,使用显示的第一个示例here

我的具体代码是:

private FileSystemResourceReference getImageReference(String name, String fullPath) {
    try {
        Path path = FileSystemResourceReference.getPath(URI.create("file://" + fullPath));
        return new FileSystemResourceReference(name, path);
    } catch (Exception e) {
        LOG.error(e, e);
        return null;
    }
}

当我在部署后转到页面时,我在页面加载时会在日志中出现异常,其中心就是:

Field hierarchy is:
  2 [class=com.stuff.MyPage, path=2]
    private java.lang.Object org.apache.wicket.MarkupContainer.children [class=java.util.ArrayList]
      private java.lang.Object org.apache.wicket.MarkupContainer.children[write:21][write:24] [class=org.apache.wicket.markup.html.WebMarkupContainer, path=2:imageContainer]
        private java.lang.Object org.apache.wicket.MarkupContainer.children [class=java.util.ArrayList]
          private java.lang.Object org.apache.wicket.MarkupContainer.children[write:1] [class=org.apache.wicket.markup.html.image.Image, path=2:imageContainer:myImage]
            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.request.resource.ResourceReference org.apache.wicket.markup.html.image.resource.LocalizedImageResource.resourceReference [class=org.apache.wicket.resource.FileSystemResourceReference]
                private java.nio.file.Path org.apache.wicket.resource.FileSystemResourceReference.path [class=sun.nio.fs.UnixPath] <----- field that is causing the problem

如果是我自己的课程,可以通过添加implements java.io.Serializable来轻松修复,但我不确定在这种情况下该怎么做。页面似乎工作正常(似乎,到目前为止),但日志变得非常难看。

0 个答案:

没有答案