Differences between revisions 1 and 2
Revision 1 as of 2006-10-24 20:38:47
Size: 1152
Editor: StanSilvert
Comment:
Revision 2 as of 2009-09-20 23:00:41
Size: 1154
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 25: Line 25:
'''If you want to use your own serial factory as per [http://wiki.apache.org/myfaces/Performance Performance], you can just replace !DefaultSerialFactory with the fully-qualified class name of your own implementation.''' '''If you want to use your own serial factory as per [[http://wiki.apache.org/myfaces/Performance|Performance]], you can just replace !DefaultSerialFactory with the fully-qualified class name of your own implementation.'''

MyFaces 1.1.4 has a bug that can cause the following error in a portlet environment:

java.lang.NullPointerException: serialFactory
        at org.apache.myfaces.shared_impl.util.StateUtils.getAsByteArray(StateUtils.java:174)
        at org.apache.myfaces.shared_impl.util.StateUtils.construct(StateUtils.java:150)
        at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.writeState(HtmlResponseStateMa
nager.java:73)
        at org.apache.myfaces.application.jsp.JspStateManagerImpl.writeState(JspStateManagerImpl.jav
a:430)

To work around this problem, extend MyFacesGenericPortlet and override the init() method as follows:

public void init() throws PortletException, UnavailableException
{
   super.init();
   getPortletContext().setAttribute("org.apache.myfaces.SERIAL_FACTORY", new org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory()); 
}

If you want to use your own serial factory as per Performance, you can just replace DefaultSerialFactory with the fully-qualified class name of your own implementation.

PortletSerialFactoryWorkaround (last edited 2009-09-20 23:00:41 by localhost)