I think there is a thread on your backend writing to the ArrayList at the
same time your action class is reading the sam ArrayList instance.

I also had this problem and I fixed it by synchronizing the Arraylist during
the write(add) process.

synchronized (this.myArrayList) {
        this.myArrayList.add(someElement);
}

Hope this helps.

Kind regards,

-----Oorspronkelijk bericht-----
Van: Fedor Smirnoff [mailto:[EMAIL PROTECTED]
Verzonden: zondag 22 juni 2003 0:06
Aan: Struts Users Mailing List
Onderwerp: Re: java.util.ConcurrentModificationException at
org.apache.struts.action.ActionMessages.add(ActionMessages.java:185)


I am not using 2 threads, I was just saying than in
case of two threds being used, this Exception will be
thrown.  I can find whats the problem in my casei got
this:

     <html:select property="colorSelected">
       <html:options property="colorOptions"
 name="orderEntryForm"/>
     </html:select>

 where colorSelected is a String with getter and
 setter in the orderEntry form bean, and colorOptions
is being returned by a getter in the same bean as an
 ArrayList.
 Something like this:

   public ArrayList getColorOptions() {
       colorOptions.add("red");
       colorOptions.add("green");
       return colorOptions;

Exception is being thrown when I am tryin to run it,
however if I return a String[] instead of ArrayList,
evetyhing works great.

Any ideas?

Thaks
Fedor
--- Sandeep Takhar <[EMAIL PROTECTED]> wrote:
> You don't need two threads.
>
> If you are using an iterator and are removing from
> the
> collection you are iterating over - you will get
> this
> error.
>
> If you are using EJB CMP then you need to know how
> relationships work because it is easy to run into
> this.
>
> sandeep
> --- Fedor Smirnoff <[EMAIL PROTECTED]> wrote:
> > Hi I asked similar question and yet did not get an
> > answer, I dont know why its happening in my case,
> > however, I know that
> ConcurrentModificationException
> > is thrown when a thread is trying to modify a
> > collection while another thread is still iterating
> > it.
> > Dont know if it helps you or not sorry.
> >
> > Sincerely,
> > Fedor
> >
> > --- Michael Ruppin <[EMAIL PROTECTED]> wrote:
> > > I'm getting the following, using 1.1-rc1
> > > ActionMessages.add(ActionMessages messages):
> > >
> > > [6/20/03 11:15:23:344 CDT]  2d4fa5a WebGroup
>
> > E
> > > SRVE0026E: [Servlet Error]-[AxisPortalServlet]:
> > > java.util.ConcurrentModificationException
> > >   at
> > >
> >
>
java.util.AbstractList$Itr.checkForComodification(AbstractList.java(Inlined
> > > Compiled Code))
> > >   at
> > >
> >
>
java.util.AbstractList$Itr.next(AbstractList.java(Compiled
> > > Code))
> > >   at
> > >
> >
>
org.apache.struts.action.ActionMessages.add(ActionMessages.java:185)
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > SBC Yahoo! DSL - Now only $29.95 per month!
> > > http://sbc.yahoo.com
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> >
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.488 / Virus Database: 287 - Release Date: 5/06/2003


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to