开发者

JSF index out of bounds exception when submiting a form

开发者 https://www.devze.com 2023-02-09 04:27 出处:网络
When I click submit button in a JSF form the following exception occurs. It says an Indexout of bounds exception, but I did not use any ArrayList associated with the code. Is this a bug? what should i

When I click submit button in a JSF form the following exception occurs. It says an Indexout of bounds exception, but I did not use any ArrayList associated with the code. Is this a bug? what should i do to get rid of this error..

Mojarra: 2.0.2 FCS with primefaces 2.2

JSF: 2.0

NetBeans IDE 6.8

Glassfish Domain V3

Form Code:

<p:panel id="jobres" style="min-width: 200px" header="Reservation" widgetVar="jres" closable="true" toggleable="true" >
                            <h:form id="arj" prependId="false" style="width:550px;max-height:400px;overflow:auto;">
                                <p:tooltip global="true"/>
                                <h:panelGrid columns="2" >
                                    <p:panel style="min-width: 220px">
                                        <h:outputLabel value="1.Job type:"/>
                                    </p:panel>
                                    <h:panelGroup>
                                        <h:messages id="aerr"/>
                                        <h:selectOneMenu  title="Choose a Jobtype"  value="#{arjob.jobtype}">
                                            <f:selectItem itemLabel="Sequential" itemValue="sequential"/>
                                            <f:selectItem itemLabel="Parallel" itemValue="parallel"/>
                                        </h:selectOneMenu>
                                    </h:panelGroup>
                                    <p:panel>
                                        <h:outputLabel value="2.Executable: *"/>
                                    </p:panel>
                                    <h:panelGroup>
                                        <p:fileUpload id="aexeupload" fileUploadListener="#{arjob.chooseListener}" auto="true" update="adlist :erdialog" description="Resource Files">
                                        </p:fileUpload>
                                        <br/>
                                        <h:panelGroup  id="aexelistwrapper">
                                            <p:dataList var="fileList"  type="ordered"  id="adlist"  value="#{arjob.fexelist}">
                                                <p:column>
                                                    #{fileList}&nbsp;
                                                    <p:commandLink ajax="true"  update="aexelistwrapper" actionListener="#{arjob.removeExe(fileList)}">
                                                        <p:graphicImage value="images/closebar.png"/>
                                                    </p:commandLink>
                                                </p:column>
                                            </p:dataList>
                                        </h:panelGroup>
                                    </h:panelGroup>
                                    <p:panel>
                                        <h:outputLabel value="3.Argument(s):"/>
                                    </p:panel>
                                    <h:panelGroup>
                                        <u style="color:orange">
                                            <i>
                                                <p:inplace   emptyLabel="Add Arguments"  onEditUpdate="aarglist">
                                                    <h:inputText title="Enter the arguments" id="aiparg" value="#{arjob.args}">
                                                        <f:ajax event="valueChange"/>
                                                    </h:inputText>
                                                    <p:commandButton update="aarglistwrapper erdialog" value="add"  actionListener="#{arjob.addArg}"/>
                                                </p:inplace>
                                            </i>
                                        </u>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <h:panelGrid id="aarglistwrapper">
                                            <p:dataList id="aarglist" type="ordered" var="args" value="#{arjob.arglist}">
                                                <p:column id="col2">
                                                    #{args}&nbsp;
                                                    <p:commandLink ajax="true" update="arj:arglistwrapper" actionListener="#{arjob.removeArgs(args)}">
                                                        <p:graphicImage title="remove" value="images/closebar.png"/>
                                                    </p:commandLink>
                                                </p:column>
                                            </p:dataList>
                                        </h:panelGrid>
                                    </h:panelGroup>
                                    <p:panel>
                                        <h:outputLabel value="4.InputFile(s): *"/>
                                    </p:panel>
                                    <h:panelGroup>
                                        <p:fileUpload id="ainpupload" fileUploadListener="#{arjob.inputChooseListener}" auto="true" update="aipfilelistwrapper :erdialog" description="Resource Files">
                                        </p:fileUpload>
                                        <br/>
                                        <h:panelGroup  id="aipfilelistwrapper">
                                            <p:dataList var="ipfile"  type="ordered"   id="aipflist"  value="#{arjob.finlist}">
                                                <p:column>
                                                    #{ipfile}&nbsp;
                                                    <p:commandLink ajax="true"  update="aipfilelistwrapper" actionListener="#{arjob.removeInfile(ipfile)}">
                                                        <p:graphicImage value="images/closebar.png"/>
                                                    </p:commandLink>
                                                </p:column>
                                            </p:dataList>
                                        </h:panelGroup>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <p:panel >
                                            5)Output File(s):
                                        </p:panel>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <u style="color:orange">
                                            <i>
                                                <p:inplace   emptyLabel="Add file name" id="aipexe">
                                                    <h:inputText title="Enter the output filenames" id="aexe" value="#{arjob.ofilename}">
                                                        <f:ajax event="valueChange"/>
                                                    </h:inputText>
                                                    <p:commandButton update="adoutlist :erdialog" value="add"  actionListener="#{arjob.addOutfile}"/>
                                                </p:inplace>
                                            </i>
                                        </u>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <h:panelGrid id="afilelistwrapper">
                                            <p:dataList id="adoutlist" type="ordered" var="ofile" value="#{arjob.foutlist}">
                                                <p:column id="acol">
                                                    #{ofile}&nbsp;
                                                    <p:commandLink ajax="true" update="afilelistwrapper" actionListener="#{arjob.removeOutfile(ofile)}">
                                                        <p:graphicImage value="images/closebar.png"/>
                                                    </p:commandLink>
                                                </p:column>
                                            </p:dataList>
                                        </h:panelGrid>
                                    </h:panelGroup>
                                    <p:panel>
                                        <h:outputLabel value="6) Operating System"/>
                                    </p:panel>
                                    <h:panelGroup>
                                        <h:selectOneMenu  title="Select an OperatingSystem"  value="#{arjob.os}">
                                            <f:selectItem itemLabel="CentOS Release 5.2" itemValue="Cent OS 5.2"/>
                                            <f:selectItem itemLabel="RHEL Server Release 5" itemValue="RHEL server 5"/>
                                            <f:selectItem itemLabel="RHEL Server Release 5.2" itemValue="RHEL server 5.2"/>
                                        </h:selectOneMenu>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <p:panel>
                                            <h:outputLabel value="7) Physical Memory:"/>
                                        </p:panel>
                                    </h:panelGroup>
                                    开发者_C百科<h:panelGroup>
                                        <p:spinner min="0" style="width: 100px" stepFactor="10" value="#{arjob.mem}">
                                        </p:spinner>(MB)
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <p:panel>
                                            <h:outputLabel value="8) Disk Space:"/>
                                        </p:panel>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <p:spinner min="0" style="width: 100px" stepFactor="10" value="#{arjob.diskspace}">
                                        </p:spinner>(MB)
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <p:panel>
                                            <h:outputLabel value="9) CPU Mhz:"/>
                                        </p:panel>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <p:spinner min="0" style="width: 100px" stepFactor="10" value="#{arjob.cpumhz}">
                                        </p:spinner>(Mhz)
                                    </h:panelGroup>

                                    <p:panel>
                                        <h:outputLabel value="10) Start Time:"/>
                                    </p:panel>

                                    <h:panelGroup>
                                        <p:inputMask title="(YYYY-MM-DD HH:MM:SS)"  mask="9999-99-99 99:99:99"  value="#{arjob.startt}">
                                        </p:inputMask>
                                    </h:panelGroup>

                                    <p:panel>
                                        <h:outputLabel value="11) End Time:"/>
                                    </p:panel>

                                    <h:panelGroup>
                                        <p:inputMask title="(YYYY-MM-DD HH:MM:SS)"  mask="9999-99-99 99:99:99"  value="#{arjob.endt}">
                                            <p:ajax event="valueChange"/>
                                        </p:inputMask>
                                    </h:panelGroup>
                                    <p:panel>
                                        <h:outputLabel value="12) LRMS type"/>
                                    </p:panel>
                                    <h:panelGroup>
                                        <h:selectOneMenu value="#{arjob.lrms}">
                                            <f:selectItem itemLabel="PBS" itemValue="PBS"/>
                                            <f:selectItem itemLabel="SGE" itemValue="SGE"/>
                                        </h:selectOneMenu>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <p:panel>
                                            <h:outputLabel value="13)Number of Nodes: *"/>
                                        </p:panel>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <h:panelGroup>
                                            <p:spinner style="width: 100px" min="1" max="100" value="#{arjob.numnodes}">
                                            </p:spinner>
                                        </h:panelGroup>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                    </h:panelGroup>
                                    <h:panelGroup>
                                        <p:commandButton ajax="false" value="Submit" action="#{arjob.jobSubmitAction}"/>
                                    </h:panelGroup>
                                </h:panelGrid>
                            </h:form>
                            <p:draggable for="jobres" handle=".ui-panel-titlebar"/>
                        </p:panel>

Exception:

SEVERE: javax.faces.FacesException: Unexpected error restoring state for component with id j_idt7.  Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0.
    at com.sun.faces.application.view.StateManagementStrategyImpl$2.visit(StateManagementStrategyImpl.java:239)
    at com.sun.faces.component.visit.FullVisitContext.invokeVisitCallback(FullVisitContext.java:147)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1446)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
    at com.sun.faces.application.view.StateManagementStrategyImpl.restoreView(StateManagementStrategyImpl.java:223)
    at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:177)
    at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:131)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:430)
    at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
    at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:288)
    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:233)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
    at java.util.ArrayList.get(ArrayList.java:322)
    at javax.faces.component.AttachedObjectListHolder.restoreState(AttachedObjectListHolder.java:161)
    at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1427)
    at com.sun.faces.application.view.StateManagementStrategyImpl$2.visit(StateManagementStrategyImpl.java:231)
    ... 45 more


I have found out that this is a bug in the primefaces 2.2 final release, which has been released recently.

I solved this exception by using the previous version of primefaces (2.2 RC2)

0

精彩评论

暂无评论...
验证码 换一张
取 消