Duplicate entry 0 for key PRIMARY exceptions during plugin update
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
問題
Updating plugins in Confluence triggers Duplicate entry '0' for key 'PRIMARY
in atlassian-confluence.log:
2016-03-25 21:38:43,746 ERROR [UpmAsynchronousTaskManager:thread-2] [atlassian.event.internal.AsynchronousAbleEventDispatcher] run There was an exception thrown trying to dispatch event [com.atlassian.plugin.event.events.PluginModuleEnabledEvent for com.atlassian.support.stp:stpWhitelist (null)] from the invoker [com.atlassian.confluence.event.ConfluenceListenerHandlersConfiguration$TimingListenerHandler$1$1@1562eb20]
-- url: /rest/plugins/1.0/ | referer: http://URL/plugins/servlet/upm | userName: user
java.lang.RuntimeException: There was a SQL exception thrown by the Active Objects library:
Database:
- name:MySQL
- version:5.6.28-76.1
- minor version:6
- major version:5
Driver:
- name:MySQL Connector Java
- version:mysql-connector-java-5.1.38 ( Revision: fe541c166cec739c74cc727c5da96c1028b4834a )
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '0' for key 'PRIMARY'
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54)
at com.atlassian.confluence.event.ConfluenceListenerHandlersConfiguration$TimingListenerHandler$1$1.invoke(ConfluenceListenerHandlersConfiguration.java:69)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:46)
at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:105)
..............
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library:
Database:
- name:MySQL
- version:5.6.28-76.1
- minor version:6
- major version:5
Driver:
- name:MySQL Connector Java
- version:mysql-connector-java-5.1.38 ( Revision: fe541c166cec739c74cc727c5da96c1028b4834a )
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '0' for key 'PRIMARY'
at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:88)
at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects.create(TenantAwareActiveObjects.java:261)
..............
at com.sun.proxy.$Proxy850.execute(Unknown Source)
at com.atlassian.confluence.plugins.featurediscovery.PluginModuleEventListener.scanForNewPluginModules(PluginModuleEventListener.java:139)
at com.atlassian.confluence.plugins.featurediscovery.PluginModuleEventListener.onPluginModuleEnabled(PluginModuleEventListener.java:99)
at sun.reflect.GeneratedMethodAccessor153.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36)
... 113 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '0' for key 'PRIMARY'
at sun.reflect.GeneratedConstructorAccessor360.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.Util.getInstance(Util.java:387)
.........
原因
In MySQL configuration ( my.ini (Windows) or my.cnf (Unix) ), parameter of sql_mode
is set to NO_AUTO_VALUE_ON_ZERO
.
ソリューション
According to Database Setup For MySQL, you have to remove sql_mode = NO_AUTO_VALUE_ON_ZERO
from MySQL configuration file:
- Stop the application.
- Stop MySQL
- Edit the
my.cnf
file (often namedmy.ini
on Windows operating systems or my.cnf on UNIX operating systems) in your MySQL server. Remove
NO_AUTO_VALUE_ON_ZERO
fromsql_mode
.- Start MySQL
- アプリケーションを開始します。