We're experiencing a JSF issue migrating one of our apps from WebSphere 6.1 (JSF 1.1 Impl) to WebSphere 7.0( JSF 1.2 Impl, Sun Impl [default in v7.0]). The app uses an IBM jar which IBM tell me is a widget providing custom IBM JSF functionality and tags etc (jsf-ibm.jar), and we have what we believe is the required ver for JSF 1.2 Impl support.
When we hit the app we get an error around a custom component which has a backing UI class. The app loads ok when we access initially but when we hit any buttons on the control or anywhere else we get the following exception (below). The custom component is a paging control and is added to the page as below:
<appname:dataTableNav id="navTable1" dataComponent="#{appSession.cLog.cLogLine}" pageSize="#{appSession.cLogPreferences.pageSize}" startingIndex="#{appSession.caseLog.cLogPref.startingIndex}" actionListener="#{pc_Log.handleSelectedPageEvent}" backImage="images/arrow_previous.gif"forwardImage="images/arrow_next.gif" pageStyleClass="resultlinks" currentPageStyleClass="selectedPage"/>
IBM suggested the issue is that the JSF 1.2 Impl is having trouble rendering the custom control, as JSF 1.1 behaves differently than 1.2 when saving / serializing custom control states etc, and rendering again. They suggested we were missing the saveState & restoreState methods in the backing UI class which I added but to no success, ie our code snippet below and code reference url for such:
** Ref url:
http://blog.evolutionarydawn.com/2009/06/11/custom-jsf-component-12/
** Our code snippet:
public Object saveState(FacesContext context) {
System.out.println("Out .. In DataTableNavigatorUI.saveState-Begin!");
Object values[] = new Object[5];
values[0] = super.saveState(context);
values[1] = forwardImage;
values[2] = backImage;
values[3] = pageStyleClass;
values[4] = currentPageStyleClass;
System.out.println("Out .. In DataTableNavigatorUI.saveState-Exit!");
return ((Object) (values));
}
public void restoreState(FacesContext context, Object state) {
System.out.println("Out .. In DataTableNavigatorUI.restoreState-Begin!");
Object values[] = (Object[])state;
super.restoreState(context, values[0]);
forwardImage = (String) values[1];
backImage = (String) values[2];
pageStyleClass = (String) values[3];
currentPageStyleClass = (String) values[4];
System.out.println("Out .. In DataTableNavigatorUI.restoreState-Exit!");
}
From IBM support:
The component class is missing the saveState and restoreState methods. This will result in this custom component's state to not be saved and restored which I believe is leading to the ArrayIndexOutOfBoundsException.
I can see this code is getting called when debugging and via logging and can debug each method when called and can inspect the values which are getting captured and restored (when I inspect via debug).
As u can see from the stack trace below the app seems to be falling over within the JSF framework code, so not sure if we need to modify our code with what the framework needs!?
So we're at a complete loss and so would welcome any ideas, solutions or feedback.
Thanks & Regards, Stephen
Exception stack trace: [8/13/12 15:01:24:101 BST] 00000029 servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet Faces Servlet in application spocs-ear. Exception created : javax.servlet.ServletException: Array index out of range: 12 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1663) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131) at com.ourapp.ourapp2.ourapp3.web.filter.LogonFilter.doFilter(LogonFilter.java:173) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) at com.ourapp.ourapp2.ourapp3.web.filter.UploadMultipartFilter.doFilter(UploadMultipartFilter.java:61) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:188) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:116) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3826) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301) 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:1563) Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 12 at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1167) at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1171) at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1171) at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1171) at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:205) at com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:337) at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:176) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:104) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) ... 31 more