[NEWBIE]ConcurrentModificationException

Discussion in 'Java' started by Federico, Jul 21, 2003.

  1. Federico

    Federico Guest

    Hi all,

    I'm writing a servlet for the management of a mailing list.


    The Mailing list is an html page with an attacchment where the
    personal data (email, name, title) are taken from an XML file using
    the JDOM API, in which I navigate using the the "Iterator" Object .


    For giving the possibily of erasing from the mailing list there in the
    HTML page sent by mail there is a link where one can go to a servlet
    with the email address passed as a parameter. This parameter is used
    to retrieve the rest of the information (name and title) using again
    the "iterator" object in the JDOM tree obtained from the same XML
    file. (step 1)

    Once all the information are retrieved, they are showed in a web page,
    asking the confirmation for the deleting. This confirmation is a call
    to another servlet always with the email address passed as a
    parameter. (step 2)

    In this last servlet the JDOM tree is "iterated" again to find the
    correspondence with the email address parameter and the element which
    contain it, so this element could be erased (with all the related
    data). (step 3)

    Now the problem is that when I pass from the step 2 to the step 3,
    when the last servlet is called I receive this error:


    description The server encountered an internal error () that prevented
    it from fulfilling this request.

    java.util.ConcurrentModificationException
    at
    org.jdom.ContentList$FilterListIterator.checkConcurrentModification(ContentList.java:1230)
    at
    org.jdom.ContentList$FilterListIterator.hasNext(ContentList.java:942)
    at
    DeleteAddressServlet.processRequest(DeleteAddressServlet.java:50)
    at DeleteAddressServlet.doPost(DeleteAddressServlet.java:141)
    at

    etc. etc. etc.

    It seems that I can't call again an Iterator on the same file from the
    second servlet to the third because Tomcat says that you can't modify
    a file from two servlet at the same time.

    How can I evade this?

    I've tried to call another iterator object but it doesn't work. There
    is a way to "close" a file from the second servlet to the third, so
    not to have this exception?

    Thank you
    Federico
    Federico, Jul 21, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrea Hahn
    Replies:
    0
    Views:
    438
    Andrea Hahn
    Aug 18, 2003
  2. Michael T. Peterson

    [Q] ConcurrentModificationException

    Michael T. Peterson, Sep 26, 2003, in forum: Java
    Replies:
    1
    Views:
    469
    VisionSet
    Sep 26, 2003
  3. Roedy Green
    Replies:
    3
    Views:
    11,511
    Roedy Green
    Jul 6, 2005
  4. Damo
    Replies:
    4
    Views:
    700
    Hendrik Maryns
    Jan 18, 2007
  5. Bill David
    Replies:
    4
    Views:
    1,116
    Mike Schilling
    Dec 21, 2007
Loading...

Share This Page