1 Reply Latest reply on Apr 16, 2009 6:37 AM by Ilya Shaikovsky

    java.io.NotSerializableException with a4j:keepAlive

    engy morsy Newbie

      I had a JSF form that contains a richfaces tree and i am using a4j:keepAlive to preserve request scope bean state.

      When I first used keepAlive i got SerializableException for other beans in the same form so i implement Serializable interface but then I encounter the exception below which i won't be able to modify, could you please help?


      >>>>>>>>>Snapshot from Code>>>>>>>>>>>>
      <a4j:keepAlive beanName="bookmarkTreeController"></a4j:keepAlive>

      <h:panelGrid id="TreePanel" columns="2" width="100%">
      <a4j:form dir="#{localeBean.localeDir}">
      <h:panelGrid id="displayTree">

      <!-- Original Tree -->
      <h:panelGrid id="Tree" style=" width:100%; font-size:12px; color: #666666;">
      <rich:tree styleClass="tree"
      binding="#{bookmarkTreeController.tree}"
      dragIndicator=":indicator"
      showConnectingLines = "flase"
      dropListener="#{bookmarkTreeController.processDrop}"
      value="#{bookmarkTreeController.treeValue}"
      var="item"
      nodeFace="#{item.nodeType}"
      preserveModel="none"
      immediate="false"
      selectedClass="selectedTree"
      onexpand="loading('sidebar','sidebarStatus') "
      >
      <rich:treeNode id="parentGroup" type="parentGroup"
      acceptedTypes="bookmark,group"
      dropValue="#{item.bookmarkGroupID}" >
      <f:facet name="icon">
      <h:graphicImage value="/images/#{localeBean.applicationLocale}/Foldericon.gif"/>
      </f:facet>
      <f:facet name="iconCollapsed">
      <h:graphicImage value="/images/#{localeBean.applicationLocale}/Collapsed.gif" />
      </f:facet>
      <f:facet name="iconExpanded">
      <h:graphicImage value="/images/expanded.gif" />
      </f:facet>
      <f:facet name="iconLeaf" >
      <h:graphicImage value="/images/#{localeBean.applicationLocale}/Foldericon.gif" />
      </f:facet>
      <h:outputText value="#{item.bookmarkGroupName}" />
      </rich:treeNode>
      <rich:treeNode type="group"
      acceptedTypes="bookmark"
      dropValue="#{item.bookmarkGroupID}"
      ondblclick="showSelectedGroup('#{item.bookmarkGroupID}')"
      >
      <f:facet name="icon">
      <h:graphicImage value="/images/#{localeBean.applicationLocale}/Foldericon.gif"/>
      </f:facet>
      <f:facet name="iconCollapsed">
      <h:graphicImage value="/images/#{localeBean.applicationLocale}/Collapsed.gif" />
      </f:facet>
      <f:facet name="iconExpanded">
      <h:graphicImage value="/images/expanded.gif" />
      </f:facet>
      <f:facet name="iconLeaf">
      <h:graphicImage value="/images/#{localeBean.applicationLocale}/Foldericon.gif" />
      </f:facet>
      <h:outputText value="#{item.bookmarkGroupName}" />
      <rich:toolTip value="#{msgs.ShowGroupTip}"></rich:toolTip>
      </rich:treeNode>
      <rich:treeNode type="bookmark"
      dragType="bookmark"
      dragValue="#{item}"
      ondblclick="showSelectedBookmark('#{item.bookmarkGroupID}','#{item.bookmarkID}')"
      >
      <f:facet name="icon">
      <h:graphicImage value="/images/#{localeBean.applicationLocale}/Foldericon.gif"/>
      </f:facet>
      <f:facet name="iconCollapsed">
      <h:graphicImage value="/images/#{localeBean.applicationLocale}/Collapsed.gif" />
      </f:facet>
      <f:facet name="iconExpanded">
      <h:graphicImage value="/images/expanded.gif" />
      </f:facet>
      <f:facet name="iconLeaf">
      <h:graphicImage value="/images/#{localeBean.applicationLocale}/iconnode.gif" />
      </f:facet>
      <h:outputText value="#{item.bookmarkName}" />
      <rich:dndParam name="label" type="drag" value="Bookmark: #{item.bookmarkName}" />
      <rich:toolTip value="#{msgs.ShowBookmarkAndDragTip}"></rich:toolTip>
      </rich:treeNode>
      </rich:tree>


      </h:panelGrid>
      </h:panelGrid>
      </a4j:form>
      >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

      >>>Exception>>>>>>>>>>>>>>>>>>>>>>

      java.io.NotSerializableException: org.richfaces.component.html.HtmlTree
      java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
      java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
      java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
      java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      java.util.HashMap.writeObject(HashMap.java:1001)
      sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      java.lang.reflect.Method.invoke(Method.java:597)
      java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
      java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      com.sun.faces.renderkit.ResponseStateManagerImpl.writeState(ResponseStateManagerImpl.java:269)
      javax.faces.render.ResponseStateManager.writeState(ResponseStateManager.java:166)
      org.ajax4jsf.application.AjaxStateManager.writeState(AjaxStateManager.java:294)
      org.ajax4jsf.application.AjaxStateManager.writeState(AjaxStateManager.java:256)
      com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:620)
      org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
      org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
      com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
      org.bibalex.nemo.filters.AuthenticationFilter.doFilter(AuthenticationFilter.java:71)
      org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:100)
      org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)