java.util.ConcurrentModificationException

Hibernate JIRA | Justin DeWind | 5 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    ConcurrentModificationException thrown while flushing changes to database

    Stack Overflow | 2 years ago
    java.util.ConcurrentModificationException
  2. 0

    A ConcurrentModificationException is being thrown while Hibernate is flushing changes to the database. Specifically, it occurs while it is persisting new "collections" (i.e. one-to-many) entities. Stacktrace: java.util.ConcurrentModificationException at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372) at java.util.AbstractList$Itr.next(AbstractList.java:343) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:353) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:279) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1214) at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:986) I do have a Post-Insert, Update, Collection Recreate, Collection Update listener where ConcurrentModificationException is only occurring if this listener is in place. However, the listener and actions it takes doesn't modify any entities or make save changes. So I am bit miffed. This is occurring in what appears to be a single threaded environment. At the very least the entity manager is thread local which means the hibernate events list shouldn't be modified concurrently. It leads me to believe that the list is being modified within the for loop somehow...

    Hibernate JIRA | 5 years ago | Justin DeWind
    java.util.ConcurrentModificationException
  3. 0

    A ConcurrentModificationException is being thrown while Hibernate is flushing changes to the database. Specifically, it occurs while it is persisting new "collections" (i.e. one-to-many) entities. Stacktrace: java.util.ConcurrentModificationException at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372) at java.util.AbstractList$Itr.next(AbstractList.java:343) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:353) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:279) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1214) at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:986) I do have a Post-Insert, Update, Collection Recreate, Collection Update listener where ConcurrentModificationException is only occurring if this listener is in place. However, the listener and actions it takes doesn't modify any entities or make save changes. So I am bit miffed. This is occurring in what appears to be a single threaded environment. At the very least the entity manager is thread local which means the hibernate events list shouldn't be modified concurrently. It leads me to believe that the list is being modified within the for loop somehow...

    Hibernate JIRA | 5 years ago | Justin DeWind
    java.util.ConcurrentModificationException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    4 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.util.ConcurrentModificationException

      No message provided

      at java.util.AbstractList$Itr.checkForComodification()
    2. Java RT
      AbstractList$Itr.next
      1. java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
      2. java.util.AbstractList$Itr.next(AbstractList.java:343)
      2 frames
    3. Hibernate
      SessionImpl.flush
      1. org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:353)
      2. org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:279)
      3. org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
      4. org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
      5. org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1214)
      5 frames
    4. Hibernate EJB
      AbstractEntityManagerImpl.flush
      1. org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:986)
      1 frame