4

This is a new Sonarqube 5.2 installation on windows server 2012R2 with a MS SQL Server 2012 database

Driver: Microsoft JDBC Driver 4.1 for SQL Server, version: 4.1.5605.100

The analysis files are uploaded ok but when the job is processed I see errors like the following

2015.12.03 17:11:22 ERROR [o.s.s.c.t.CeWorkerRunnableImpl] Failed to execute task AVFo0pZECnZ7xJR5PoU8
org.apache.ibatis.exceptions.PersistenceException: 
### Error committing transaction.  Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Cannot insert duplicate key row in object 'dbo.issues' with unique index 'issues_kee'. The duplicate key value is (AVFo0wtzCnZ7xJR5PrRx).
### Cause: org.apache.ibatis.executor.BatchExecutorException: org.sonar.db.issue.IssueMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Cannot insert duplicate key row in object 'dbo.issues' with unique index 'issues_kee'. The duplicate key value is (AVFo0wtzCnZ7xJR5PrRx).
    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:177) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.commit(DefaultSqlSession.java:169) ~[mybatis-3.2.7.jar:3.2.7]
    at org.sonar.db.DbSession.commit(DbSession.java:60) ~[sonar-db-5.2.jar:na]
    at org.sonar.db.BatchSession.commit(BatchSession.java:176) ~[sonar-db-5.2.jar:na]
    at org.sonar.db.BatchSession.increment(BatchSession.java:213) ~[sonar-db-5.2.jar:na]
    at org.sonar.db.BatchSession.insert(BatchSession.java:133) ~[sonar-db-5.2.jar:na]
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51) ~[mybatis-3.2.7.jar:3.2.7]
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) ~[mybatis-3.2.7.jar:3.2.7]
    at com.sun.proxy.$Proxy103.insert(Unknown Source) ~[na:na]
    at org.sonar.server.computation.step.PersistIssuesStep.execute(PersistIssuesStep.java:70) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:39) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.taskprocessor.report.ReportTaskProcessor.process(ReportTaskProcessor.java:53) ~[sonar-server-5.2.jar:na]
    at org.sonar.server.computation.taskprocessor.CeWorkerRunnableImpl.executeTask(CeWorkerRunnableImpl.java:78) [sonar-server-5.2.jar:na]
    at org.sonar.server.computation.taskprocessor.CeWorkerRunnableImpl.run(CeWorkerRunnableImpl.java:55) [sonar-server-5.2.jar:na]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.8.0_45]
    at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [na:1.8.0_45]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source) [na:1.8.0_45]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [na:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_45]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_45]

One of the projects has run a couple times successfully and I can see results in the dashboard but other projects fail !00% of the time

Is this a bug or something in the analysis being uploaded?

Richard
  • 1,804
  • 16
  • 22

1 Answers1

2

Try to change SQL collation : https://www.mssqltips.com/sqlservertip/3519/changing-sql-server-collation-after-installation/

You must have a collation with CS_AS.

It worked for me.

BonOeil
  • 158
  • 2
  • 13
  • I get the same error as OP. My Collation is set to SQL_Latin1_General_CP1_CS_AS already (before I upgraded to 5.2) – Narayana Dec 07 '15 at 11:32
  • I recreated the DB with the correct collation (instead of updating the collation of the DB and restarting), and it worked correctly. Thanks. – Narayana Dec 08 '15 at 07:27
  • I can confirm after re-creating the db with suggested collation I've not seen the error – Richard Dec 11 '15 at 08:25