java.util.ConcurrentModificationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • When using the advanced mapping mode to set a property outside of a transaction (i.e. making use of an implicit transaction), upon subsequent persistence of that enity via the persist() method, a ConcurrentModificationException occurs. StackTrace snippet shown below {noformat} http://java.util.ConcurrentModificationException: Node Michael field int age rel: false idx: true changed in between previous ExistingValue{value=null, fromGraph=true} current 35 at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.checkConcurrentModification(DetachedEntityState.java:261) at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.flushDirty(DetachedEntityState.java:208) at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.persist(DetachedEntityState.java:290) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj:133) at org.springframework.data.neo4j.aspects.Person.persist(Person.java:1) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethodDispatch1$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj) at org.springframework.data.neo4j.aspects.support.ModificationOutsideOfTransactionTests.testSetPropertyOutsideTransactionCanBePersistedThereafter(ModificationOutsideOfTransactionTests.java:193) {noformat} The following JUnit test snippet was used to recreate this problem (It can simply be added to the {{org.springframework.data.neo4j.aspects.support.ModificationOutsideOfTransactionTests}} class) {noformat} @Test public void testSetPropertyOutsideTransactionCanBePersistedThereafter() { Person p = persistedPerson( "Michael", 35 ); p.setAge( 25 ); assertEquals(25, p.getAge()); try (Transaction tx = neo4jTemplate.getGraphDatabase().beginTx()) { assertEquals( 35, nodeFor( p ).getProperty("age") ); tx.success(); } p.persist(); try (Transaction tx = neo4jTemplate.getGraphDatabase().beginTx()) { assertEquals( 25, nodeFor( p ).getProperty("age") ); tx.success(); } } {noformat} PR Issued for possible fix: https://github.com/spring-projects/spring-data-neo4j/pull/150
    via by Nicki Watt,
  • When using the advanced mapping mode to set a property outside of a transaction (i.e. making use of an implicit transaction), upon subsequent persistence of that enity via the persist() method, a ConcurrentModificationException occurs. StackTrace snippet shown below {noformat} http://java.util.ConcurrentModificationException: Node Michael field int age rel: false idx: true changed in between previous ExistingValue{value=null, fromGraph=true} current 35 at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.checkConcurrentModification(DetachedEntityState.java:261) at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.flushDirty(DetachedEntityState.java:208) at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.persist(DetachedEntityState.java:290) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj:133) at org.springframework.data.neo4j.aspects.Person.persist(Person.java:1) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethodDispatch1$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj) at org.springframework.data.neo4j.aspects.support.ModificationOutsideOfTransactionTests.testSetPropertyOutsideTransactionCanBePersistedThereafter(ModificationOutsideOfTransactionTests.java:193) {noformat} The following JUnit test snippet was used to recreate this problem (It can simply be added to the {{org.springframework.data.neo4j.aspects.support.ModificationOutsideOfTransactionTests}} class) {noformat} @Test public void testSetPropertyOutsideTransactionCanBePersistedThereafter() { Person p = persistedPerson( "Michael", 35 ); p.setAge( 25 ); assertEquals(25, p.getAge()); try (Transaction tx = neo4jTemplate.getGraphDatabase().beginTx()) { assertEquals( 35, nodeFor( p ).getProperty("age") ); tx.success(); } p.persist(); try (Transaction tx = neo4jTemplate.getGraphDatabase().beginTx()) { assertEquals( 25, nodeFor( p ).getProperty("age") ); tx.success(); } } {noformat} PR Issued for possible fix: https://github.com/spring-projects/spring-data-neo4j/pull/150
    via by Nicki Watt,
    • java.util.ConcurrentModificationException: Node Michael field int age rel: false idx: true changed in between previous ExistingValue{value=null, fromGraph=true} current 35 at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.checkConcurrentModification(DetachedEntityState.java:261) at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.flushDirty(DetachedEntityState.java:208) at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.persist(DetachedEntityState.java:290) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj:133) at org.springframework.data.neo4j.aspects.Person.persist(Person.java:1) at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethodDispatch1$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj) at org.springframework.data.neo4j.aspects.support.ModificationOutsideOfTransactionTests.testSetPropertyOutsideTransactionCanBePersistedThereafter(ModificationOutsideOfTransactionTests.java:193)
    No Bugmate found.