Duplicate entry errors in logs after upgrading Jira server with MySQL database

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Problem

After updating a JIRA application the following logs start to appear in the atlassian-jira.log:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2014-06-23 10:14:00,319 http-bio-8080-exec-25 ERROR xxx 614x203x2 p1s16e xxx.xxx.xxx.xxx /rest/activityplugin/1.0/usersettings [common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library: Database: - name:MySQL - version:5.1.54-rel12.5-log - minor version:1 - major version:5 Driver: - name:MySQL-AB JDBC Driver - version:mysql-connector-java-5.1.10 ( Revision: ${svn.Revision} ) com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '0' for key 'PRIMARY' at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:107) at com.atlassian.activeobjects.osgi.DelegatingActiveObjects.create(DelegatingActiveObjects.java:63) <+3> at java.lang.reflect.Method.invoke(Unknown Source) (...) at java.lang.Thread.run(Unknown Source) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '0' for key 'PRIMARY' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) (...) at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:103) ... 194 more

Solution

In MySQL configuration ( my.ini (Windows) or my.cnf (Unix) ), parameter of sql_mode is set to NO_AUTO_VALUE_ON_ZERO.

Resolution

  1. Stop the application.

  2. Stop MySQL

  3. Edit the my.cnf file (often named my.ini on Windows operating systems or my.cnf on UNIX operating systems) in your MySQL server.

  4. Remove NO_AUTO_VALUE_ON_ZERO from sql_mode.

  5. Start MySQL

  6. Start the application.

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.