jsfprimefacesliferaywizardnotserializableexception

java.io.NotSerializableException: com.wings.marketingevent.util.FlowWizard


I think it's simple but I got stuck with this. The idea is would like to use the liferay wizard as in: https://www.primefaces.org/showcase/ui/panel/wizard.xhtml. I have this on the xhtml:

<h:form id="frmCreate">
    <p:wizard flowListener="#{flowWizard.onFlowProcess}"> 
        <p:tab id="header" title="Header">
            <p:panel>
                /*1*/
            </p:panel>
        </p:tab>

        <p:tab id="detail" title="Detail">
            <p:panel>
                /*2*/
            </p:panel>
        </p:tab>

        <p:tab id="confirmation" title="Confirmation">
            <p:panel>
                /*3*/
            </p:panel>
        </p:tab>
    </p:wizard>
</h:form>

And on the bean:

@ManagedBean
@ViewScoped
public class FlowWizard {
    public String onFlowProcess(FlowEvent event) {
        return event.getNewStep();
    }
}

But when I tried to click NEXT button, it doesn't change the page to the next tab, and I got this error message on the console:

11:16:21,663 ERROR [ExceptionHandlerAjaxImpl:62] java.io.NotSerializableException: com.wings.marketingevent.util.FlowWizard
javax.faces.FacesException: java.io.NotSerializableException: com.wings.marketingevent.util.FlowWizard
    at com.sun.faces.renderkit.ResponseStateManagerImpl.getViewState(ResponseStateManagerImpl.java:137)
    ...
Caused by: java.io.NotSerializableException: com.wings.marketingevent.util.FlowWizard
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
    ...
Jul 13, 2013 11:16:21 AM org.apache.catalina.core.ApplicationDispatcher invoke

What's wrong? Thanks.


Solution

  • The stacktrace suggest that you need to implement Serializable at FlowWizard