Topic
No replies
jeffergj
jeffergj
1 Post
ACCEPTED ANSWER

Pinned topic JSF NullPointerException on serialFactory

‏2012-08-22T17:54:30Z |
I have two WARs on a single EAR and I'm using Websphere 8.0. Both WARs are using JSF 2.0. One of the WARs utilizes HATS, which requires a WAR classloader policy of APPLICATION (one classloader for all modules). Setting the classloader policy to APPLICATION causes the following exception when trying to navigate to any JSF page:

8/22/12 8:36:21:960 CDT] 00000024 MyfacesConfig I Starting up Tomahawk on the MyFaces-JSF-Implementation
8/22/12 8:36:25:007 CDT 00000024 ExternalSpeci I MyFaces Unified EL support enabled
8/22/12 8:36:25:648 CDT 00000024 FaceletViewDe E Error Rendering View[/application/pages/welcome.xhtml]
java.lang.NullPointerException: serialFactory
at org.apache.myfaces.shared_impl.util.StateUtils.getAsByteArray(StateUtils.java:268)
at org.apache.myfaces.shared_impl.util.StateUtils.construct(StateUtils.java:235)
at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.writeViewStateField(HtmlResponseStateManager.java:127)
at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.writeState(HtmlResponseStateManager.java:118)
at com.ibm.faces.application.AjaxResponseStateManagerImpl.writeState(AjaxResponseStateManagerImpl.java:76)
at javax.faces.render.ResponseStateManager.writeState(ResponseStateManager.java:67)
at org.apache.myfaces.application.jsp.JspStateManagerImpl.writeState(JspStateManagerImpl.java:598)
at javax.faces.application.StateManager.writeState(StateManager.java:200)
at org.apache.myfaces.application.ViewHandlerImpl.writeState(ViewHandlerImpl.java:302)
at javax.faces.application.ViewHandlerWrapper.writeState(ViewHandlerWrapper.java:65)
at javax.faces.application.ViewHandlerWrapper.writeState(ViewHandlerWrapper.java:65)
at javax.faces.application.ViewHandlerWrapper.writeState(ViewHandlerWrapper.java:65)
at javax.faces.application.ViewHandlerWrapper.writeState(ViewHandlerWrapper.java:65)
at javax.faces.application.ViewHandlerWrapper.writeState(ViewHandlerWrapper.java:65)
at javax.faces.application.ViewHandlerWrapper.writeState(ViewHandlerWrapper.java:65)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlFormRendererBase.encodeEnd(HtmlFormRendererBase.java:179)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeEnd(DefaultAjaxRenderer.java:83)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:519)
at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:540)
at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:521)
at org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:488)
at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:534)
at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:521)
at org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:488)
at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:534)
at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:521)
at org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:488)
at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:534)
at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:521)
at org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:488)
at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChild(RendererUtils.java:534)
at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.renderChildren(RendererUtils.java:521)
at org.apache.myfaces.custom.htmlTag.HtmlTagRenderer.encodeChildren(HtmlTagRenderer.java:111)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:488)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:617)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:622)
at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1320)
at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:263)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.render(CodiLifecycleWrapper.java:128)
at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.render(CodiLifecycleWrapper.java:128)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1188)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:763)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:454)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
at com.travelers.sta4j.common.filter.CacheDirectiveFilter.doFilter(CacheDirectiveFilter.java:53)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
at com.travelers.sta4j.xss.common.CrossSiteScriptingFilter.doFilter(CrossSiteScriptingFilter.java:61)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
at com.travelers.sta4j.security.common.AuthorizationFilter.doFilter(AuthorizationFilter.java:88)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
at com.travelers.sta4j.security.common.AuthenticationFilter.doFilter(AuthenticationFilter.java:108)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:919)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1016)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3703)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1659)

I found that with a WAR classloading policy of MODULE the JSF works fine but then HATS does not work correctly. Also there was some information on IBM's site surrounding classloading policy with muitple WARs where one or more modules are using JSF.

"The JSF runtime for WebSphere Application Server does not support the use of a single class loader for the entire application. This support is not available when the application contains multiple Web modules and one of those modules is a JSF module. A single class loader for the entire application is not supported because the FacesConfig initialization requires a single class loader for each JSF module to perform the initialization" -- http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Fcweb_javaserver_faces.html

But this concerns initialization and both WARs appear to initialize fine with either WAR classloading policy. So is there a workaround for this NullPointerException on SerialFactory?