A ConcurrentModificationException occurs when you have an Iterator, and then modify the underlying collection, then try to use the iterator again...
example (with bounds checking removed): List list = new ArrayList(); // populate list... Iterator i = list.iterator(); Object o = i.next(); list.remove(o); // CME thrown here... Object o2 = i.next(); The usual way to resolve these problems is to add and remove through the Iterator or ListIterator rather than directly to the underlying collection. To fix the above, you would replace "list.remove(o)" with "i.remove(o)" So, in your example, on the line: miaForm.addParm(new fw_MenuItemParmVO(null, null, false)); you are modifying the FastArrayList in the middle of the iteration. Hope this helps! --- - Nayan Hajratwala - Chikli Consulting LLC - http://www.chikli.com -----Original Message----- From: David Tam [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 03, 2002 2:12 AM To: [EMAIL PROTECTED] Subject: ConcurrentModificationException when using <nested:iterate> tag i am using Struts 1.1b2 with tiles on BES 5.0.2(tomcat 4.0.1). i ve got the following form: public final class fw_MenuItemAdminForm extends ActionForm { private List parmsAL = new FastArrayList(); private Collection parms = col1.lazyList(parmsAL, fw_MenuItemParmVO.class); public void addParm(fw_MenuItemParmVO theParm){ parms.add(theParm); } public Collection getParms(){ return parms; } } and here is my jsp: <table> <tr> <td><bean:message key="menuItemAdminForm.parmKey"/>:</td> <td><bean:message key="menuItemAdminForm.parmVal"/>:</td> </tr> <nested:iterate id="menuItemParms" property="parms" type="fw_MenuItemParmVO"> <tr> <td><nested:write property="parmKey" /><nested:hidden property="parmKey" /></td> <td><nested:write property="parmVal" /><nested:hidden property="parmVal" /></td> </tr> </nested:iterate> </table> when my dispatch action class is being called the following method is being executed: public ActionForward addParm(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ fw_MenuItemAdminForm miaForm = (fw_MenuItemAdminForm)form; logger.debug("addParm:: miaForm.getParms().size() = " + miaForm.getParms().size()); miaForm.addParm(new fw_MenuItemParmVO(null, null, false)); return (mapping.findForward("success")); } the link to the "success" forward is ok(can tell from the log) but the servlet container is throwing concurrentmodificationexception! anybody knows y is this happening?? seems that it could get though the action but when the servlet container is formatting the HTML(or running the generated xxx$jsp.java) there is this wierd problem (the following is the log i ve got from the app. server). 137908 [VBJ ThreadPool Worker] DEBUG hk.com.dbsvickers.webapp.framework.sms.fw_MenuItemAdminAction - addParm:: miaForm.getParms().size() = 0 processActionForward(menuItemAdmin.AddLayout, false) insert page='/jsp/NavSideBar.jsp'. insert page='/jsp/NavTopBar.jsp'. insert page='/jsp/basicLayout.content.jsp'. insert page='/jsp/menuItemAdminDetailsPane.jsp'. ApplicationDispatcher[/SMS_Web]: Servlet.service() for servlet jsp threw exception java.util.ConcurrentModificationException at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:440) at java.util.AbstractList$Itr.next(AbstractList.java:413) at org.apache.struts.taglib.logic.IterateTag.doAfterBody(IterateTag.java:423) at org.apache.struts.taglib.nested.logic.NestedIterateTag.doAfterBody(NestedIterate Tag.java:157) at org.apache.jsp.menuItemAdminDetailsPane$jsp._jspService(menuItemAdminDetailsPane $jsp.java:960) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:2 02) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java :679) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.j ava:570) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.jav a:493) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:818) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:390) at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:8 65) at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:487) at org.apache.jsp.basicLayout$content$jsp._jspService(basicLayout$content$jsp.java: 336) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) many many more...... . . . . . . and pls could anyone help? regards, dave _______________________ CONFIDENTIALITY NOTICE: This message, together with any attachment, is intended only for the use of the individual or entity to whom it is addressed and contains information that is privileged and confidential. If you are not the intended recipient, please be informed that any dissemination, distribution or reproduction of this message (including any attachment) is strictly prohibited. If you have received this message in error, please notify us immediately by return e-mail and delete the original message. Thank you. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>