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.

  • Running the annotation processor causes a ConcurrentModificationException. I'm using Maven and the maven-processor-plugin 1.3.7 but from looking into the sources I guess this bug occurs in any environment. JPAMetaModelEntityProcessor.createMetaModelClasses iterates of a Collection<MetaEntity> using a foreach loop and calls remove on the same collection which causes a ConcurrentModificationException. Obviously an iterator should be used instead. Here are the lines concerned: {code:java} Collection<MetaEntity> toProcessEntities = context.getMetaEmbeddables(); while ( !toProcessEntities.isEmpty() ) { Set<MetaEntity> processedEntities = new HashSet<MetaEntity>(); int toProcessCountBeforeLoop = toProcessEntities.size(); for ( MetaEntity entity : toProcessEntities ) { // see METAGEN-36 if ( generatedModelClasses.contains( entity.getQualifiedName() ) ) { toProcessEntities.remove( entity ); // XXX this causes a ConcurrentModificationException continue; } ... {code} Here is the stacktrace: {code} ... [INFO] diagnostic Note: Hibernate JPA 2 Static-Metamodel Generator 1.1.0.Final An annotation processor threw an uncaught exception. Consult the following stack trace for details. java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$ValueIterator.next(HashMap.java:822) at org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.createMetaModelClasses(JPAMetaModelEntityProcessor.java:153) at org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.process(JPAMetaModelEntityProcessor.java:133) at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:625) at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:554) at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:699) at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727) at com.sun.tools.javac.main.Main.compile(Main.java:353) at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:115) at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessorMojo.java:261) at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.execute(AbstractAnnotationProcessorMojo.java:129) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490) {code}
    via by Robin Sander,
  • Running the annotation processor causes a ConcurrentModificationException. I'm using Maven and the maven-processor-plugin 1.3.7 but from looking into the sources I guess this bug occurs in any environment. JPAMetaModelEntityProcessor.createMetaModelClasses iterates of a Collection<MetaEntity> using a foreach loop and calls remove on the same collection which causes a ConcurrentModificationException. Obviously an iterator should be used instead. Here are the lines concerned: {code:java} Collection<MetaEntity> toProcessEntities = context.getMetaEmbeddables(); while ( !toProcessEntities.isEmpty() ) { Set<MetaEntity> processedEntities = new HashSet<MetaEntity>(); int toProcessCountBeforeLoop = toProcessEntities.size(); for ( MetaEntity entity : toProcessEntities ) { // see METAGEN-36 if ( generatedModelClasses.contains( entity.getQualifiedName() ) ) { toProcessEntities.remove( entity ); // XXX this causes a ConcurrentModificationException continue; } ... {code} Here is the stacktrace: {code} ... [INFO] diagnostic Note: Hibernate JPA 2 Static-Metamodel Generator 1.1.0.Final An annotation processor threw an uncaught exception. Consult the following stack trace for details. java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$ValueIterator.next(HashMap.java:822) at org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.createMetaModelClasses(JPAMetaModelEntityProcessor.java:153) at org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.process(JPAMetaModelEntityProcessor.java:133) at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:625) at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:554) at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:699) at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727) at com.sun.tools.javac.main.Main.compile(Main.java:353) at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:115) at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessorMojo.java:261) at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.execute(AbstractAnnotationProcessorMojo.java:129) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490) {code}
    via by Robin Sander,
  • Hadoop 1.2.1 Release Notes
    via by Unknown author,
  • Hadoop 1.2.1 Release Notes
    via by Unknown author,
  • Hadoop 1.2.1 Release Notes
    via by Unknown author,
    • java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$ValueIterator.next(HashMap.java:822) at org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.createMetaModelClasses(JPAMetaModelEntityProcessor.java:153) at org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor.process(JPAMetaModelEntityProcessor.java:133) at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:625) at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:554) at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:699) at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727) at com.sun.tools.javac.main.Main.compile(Main.java:353) at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:115) at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessorMojo.java:261) at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.execute(AbstractAnnotationProcessorMojo.java:129) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor18 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor2 times, last one,
    17 more bugmates