2 Replies Latest reply on May 25, 2012 8:13 PM by Mike Woinoski

    NotSerializableException for UICalendar during Ajax request

    Mike Woinoski Newbie

      I'm working on a project where we are replacing Trinidad components with RichFaces 4.2 componenets. We're using an <a4j:commandLink> to send an Ajax request. The same tag worked with Trinidad filter. However, without the Trinidad libraries, the request now triggers a NotSerializableException for org.richfaces.component.UICalendar. If I change the value of the javax.faces.STATE_SAVING_METHOD context param from "client" to "server", the exception does not occur.

       

      This sounds simliar to Jira issue RF-10605, which was resolved for 4.0.0. Am I seeing the same bug resurfacing? Or is there a different config I should use for RichFaces client-side state saving?

       

      Thanks,

      Mike

        • 1. Re: NotSerializableException for UICalendar during Ajax request
          Lukáš Fryč Master

          Hi Mike,

           

          the UICalendar should not been serialized as whole,

           

          could you please share more details?

           

          The page / managed-bean / stacktrace.

          • 2. Re: NotSerializableException for UICalendar during Ajax request
            Mike Woinoski Newbie

            After studying the page more carefully, I realized that the <rich:calendar> tag is binding to a UICalendar in the managed bean. So it seems reasonable that I wouldn't be able to store the state of a UICalendar on the client side.

             

            My page:

            <html xmlns:h="http://java.sun.com/jsf/html"

                  xmlns="http://www.w3.org/1999/xhtml"

                  xmlns:rich="http://richfaces.org/rich">

            <h:head></h:head>

            <h:body>

                <h:form id="searchForm">

                    <rich:calendar id="dateEnd" binding="#{searchManager.dateEndUICalendar}" />

                    <h:commandButton action="search" value="Search" />

                </h:form>

            </h:body>

            </html>

             

            My (simplified) bean:

            public class SearchManager implements Serializable {
            
                private UICalendar dateUICalendar;
            
                public UICalendar getDateUICalendar() {
                    return dateUICalendar;
                }
            
                public void setDateUICalendar(UICalendar dateUICalendar) {
                    this.dateUICalendar = dateUICalendar;
                }
                
                public String search() {
                    return "display-search-results";
                }
            }
            

            Stack trace:

            Servlet failed with IOException 
            java.io.NotSerializableException: org.richfaces.component.UICalendar
                 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.writeObject(ObjectOutputStream.java:326)
                 at java.util.HashMap.writeObject(HashMap.java:1001)
                 at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
                 at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
                 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.writeObject(ObjectOutputStream.java:326)
                 at java.util.HashMap.writeObject(HashMap.java:1001)
                 at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:597)
                 at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
                 at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
                 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 com.sun.faces.renderkit.ClientSideStateHelper.doWriteState(ClientSideStateHelper.java:338)
                 at com.sun.faces.renderkit.ClientSideStateHelper.writeState(ClientSideStateHelper.java:181)
                 at com.sun.faces.renderkit.ResponseStateManagerImpl.writeState(ResponseStateManagerImpl.java:122)
                 at com.sun.faces.application.StateManagerImpl.writeState(StateManagerImpl.java:113)
                 at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225)
                 at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:436)
                 at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
                 at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
                 at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
                 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                 at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                 at com.allegient.view.util.ExceptionHandlingLifecycle.render(ExceptionHandlingLifecycle.java:58)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
                 at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
                 at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
                 at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
                 at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
                 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
                 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
                 at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
                 at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
                 at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
                 at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
                 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
                 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
                 at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)