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

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

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

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

Cause

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.

Last modified on Sep 25, 2019

Was this helpful?

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