Caused by: javax.persistence.EntityNotFoundException: Unable to find org.sonar.api.database.model.Snapshot with id 1269451
at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:113)
at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:154)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:143)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:174)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
at org.sonar.api.database.model.Snapshot_$$_javassist_4.setLast(Snapshot_$$_javassist_4.java)
at com.sonarsource.plugins.views.views2.D.B(Unknown Source)
at com.sonarsource.plugins.views.views2.D.C(Unknown Source)
at com.sonarsource.plugins.views.C.A.B(Unknown Source)
at com.sonarsource.plugins.views.C.A.B(Unknown Source)
at com.sonarsource.plugins.views.C.A.B(Unknown Source)
at com.sonarsource.plugins.views.C.A.A(Unknown Source)
at com.sonarsource.plugins.views.C.A.A(Unknown Source)
at com.sonarsource.plugins.views.C.A.executeOn(Unknown Source)
at org.sonar.batch.PostJobsExecutor.execute(PostJobsExecutor.java:57)
at org.sonar.batch.ProjectBatch.execute(ProjectBatch.java:53)
at org.sonar.batch.AggregatorBatch.analyzeProject(AggregatorBatch.java:109)
at org.sonar.batch.AggregatorBatch.analyzeProjects(AggregatorBatch.java:101)
at org.sonar.batch.AggregatorBatch.execute(AggregatorBatch.java:85)
at org.sonar.maven2.BatchMojo.executeBatch(BatchMojo.java:149)
... 37 more
The problem is identified : when several Sonar analysis are executed at the same time, leaves of views currently under construction might be deleted by classical purge jobs. Indeed the snapshots.created_at column on leaves are filled with the same values than there associated technical projects. And the purge job delete all snapshot whose created_at is older than 6 hours and status='U'.
The first dirty workaround is to feed the snapshot.created_at column with the current date.
The next and absolut solution is to create a new snapshots.build_time column.