Unable to create review due to error 'ConstraintViolationException - Could not execute JDBC batch update'

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Fisheye/Crucible is using MySQL server.

Creating review fail with the following error in the atlassian-fisheye-<date>.log:

2013-01-25 14:59:12,690 WARN  [btpool0-48 ] org.hibernate.util.JDBCExceptionReporter JDBCExceptionReporter-logExceptions - SQL Error: 1062, SQLState: 23000
2013-01-25 14:59:12,690 ERROR [btpool0-48 ] org.hibernate.util.JDBCExceptionReporter JDBCExceptionReporter-logExceptions - Duplicate entry 'Test-87197-46448' for key 'cru_source_name'
2013-01-25 14:59:12,690 ERROR [btpool0-48 ] org.hibernate.event.def.AbstractFlushingEventListener AbstractFlushingEventListener-performExecutions - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
...
Caused by: java.sql.BatchUpdateException: Duplicate entry 'Test-87197-46448' for key 'cru_source_name'
...
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'Test-87197-46448' for key 'cru_source_name'
...
2013-01-25 14:59:12,690 WARN  [btpool0-48 ] fisheye TxHelper-rollbackTxIfNotCommitted - Rolled back transaction started from:
    -> com.atlassian.crucible.actions.BaseAction.beginTx(BaseAction.java:161)
    -> com.atlassian.crucible.actions.create.CreateReviewFromChangesetAjaxAction.execute(CreateReviewFromChangesetAjaxAction.java:496)
    -> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    -> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    -> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2013-01-25 14:59:12,690 DEBUG [btpool0-48 ] fisheye RepositoryHandle-release - release engine on Test, count=0
2013-01-25 14:59:12,690 ERROR [btpool0-48 ] fisheye TotalityFilter-logExceptionDetails - Exception "org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update" (javax.servlet.ServletException) while processing "/cru/create.do" (Referer:"https://jira.intelliflo.com/browse/TEST-1657")
javax.servlet.ServletException: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
	at com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUtils.java:284)
	at com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:111)

Diagnosis

Run the following SQL command: 

SHOW CREATE DATABASE databasename; 

Check that if it is using utf8_bin collation as stated here.

Cause

Your database is not using case sensitive collation that is needed by Fisheye/Crucible.

Resolution

  1. Backup Fisheye/Crucible, Backing up and restoring Fisheye data
  2. Recreate your database with utf8_bin collation, About database encoding
  3. Restore the backup into Fisheye/Crucible
Last modified on Nov 2, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.