com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:UPDATE userassociation SET SOURCE_NAME = ? WHERE SINK_NODE_ID=? AND SINK_NODE_ENTITY=? AND ASSOCIATION_TYPE=? (Duplicate entry 'przemyslaw.marcinows-24682-Issue-WatchIssue' for key 'PRIMARY')

Atlassian JIRA | Matt | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Recently I have tried to upgrade the Jira instance (on testing server). We use mysql as a database. before: Jira v5.2.4#845-sha1:c9f4cc4 after: Jira v6.0-rc1#6085-sha1:c75e730 During the upgrade, data migration failed with the exception in the ticket description. {code} Exception thrown during upgrade: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:UPDATE userassociation SET SOURCE_NAME = ? WHERE SINK_NODE_ID=? AND SINK_NODE_ENTITY=? AND ASSOCIATION_TYPE=? (Duplicate entry 'przemyslaw.marcinows-24682-Issue-WatchIssue' for key 'PRIMARY') com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:UPDATE userassociation SET SOURCE_NAME = ? WHERE SINK_NODE_ID=? AND SINK_NODE_ENTITY=? AND ASSOCIATION_TYPE=? (Duplicate entry 'przemyslaw.marcinows-24682-Issue-WatchIssue' for key 'PRIMARY') at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.bulkUpdateByAnd(DefaultOfBizDelegator.java:694) at com.atlassian.jira.entity.Update$WhereContext.execute(Update.java:136) at com.atlassian.jira.entity.EntityEngineImpl.execute(EntityEngineImpl.java:45) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039$AssociationVisitor.lowercaseThisRow(UpgradeTask_Build6039.java:250) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039$AssociationVisitor.visit(UpgradeTask_Build6039.java:218) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039$AssociationVisitor.visit(UpgradeTask_Build6039.java:193) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl$3.consume(SelectQueryImpl.java:147) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:129) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.visitWith(SelectQueryImpl.java:142) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039.updateNamesToLowercase(UpgradeTask_Build6039.java:174) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039.updateSimpleColumn(UpgradeTask_Build6039.java:144) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039.doUpgrade(UpgradeTask_Build6039.java:95) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:673) at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:526) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:456) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:399) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:333) at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:100) at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:49) at com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:117) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:315) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:209) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:105) at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:30) at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:69) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:33) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:64) at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:54) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:UPDATE userassociation SET SOURCE_NAME = ? WHERE SINK_NODE_ID=? AND SINK_NODE_ENTITY=? AND ASSOCIATION_TYPE=? (Duplicate entry 'przemyslaw.marcinows-24682-Issue-WatchIssue' for key 'PRIMARY') at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:650) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.bulkUpdateByAnd(DefaultOfBizDelegator.java:685) ... 37 more {code} I had to {code} ALTER TABLE jira.userassociation DROP PRIMARY KEY; {code} and then upgrade proceeded to the sucessful end. {code} SELECT COUNT(*), SOURCE_NAME, SINK_NODE_ID FROM jira.userassociation GROUP BY SOURCE_NAME, SINK_NODE_ID HAVING COUNT(*)>1; {code} Results with hundreds of duplicated rows which prevents me from recreating primary key back again.

    Atlassian JIRA | 4 years ago | Matt
    com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:UPDATE userassociation SET SOURCE_NAME = ? WHERE SINK_NODE_ID=? AND SINK_NODE_ENTITY=? AND ASSOCIATION_TYPE=? (Duplicate entry 'przemyslaw.marcinows-24682-Issue-WatchIssue' for key 'PRIMARY')
  2. 0

    Recently I have tried to upgrade the Jira instance (on testing server). We use mysql as a database. before: Jira v5.2.4#845-sha1:c9f4cc4 after: Jira v6.0-rc1#6085-sha1:c75e730 During the upgrade, data migration failed with the exception in the ticket description. {code} Exception thrown during upgrade: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:UPDATE userassociation SET SOURCE_NAME = ? WHERE SINK_NODE_ID=? AND SINK_NODE_ENTITY=? AND ASSOCIATION_TYPE=? (Duplicate entry 'przemyslaw.marcinows-24682-Issue-WatchIssue' for key 'PRIMARY') com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:UPDATE userassociation SET SOURCE_NAME = ? WHERE SINK_NODE_ID=? AND SINK_NODE_ENTITY=? AND ASSOCIATION_TYPE=? (Duplicate entry 'przemyslaw.marcinows-24682-Issue-WatchIssue' for key 'PRIMARY') at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.bulkUpdateByAnd(DefaultOfBizDelegator.java:694) at com.atlassian.jira.entity.Update$WhereContext.execute(Update.java:136) at com.atlassian.jira.entity.EntityEngineImpl.execute(EntityEngineImpl.java:45) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039$AssociationVisitor.lowercaseThisRow(UpgradeTask_Build6039.java:250) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039$AssociationVisitor.visit(UpgradeTask_Build6039.java:218) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039$AssociationVisitor.visit(UpgradeTask_Build6039.java:193) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl$3.consume(SelectQueryImpl.java:147) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:129) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.visitWith(SelectQueryImpl.java:142) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039.updateNamesToLowercase(UpgradeTask_Build6039.java:174) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039.updateSimpleColumn(UpgradeTask_Build6039.java:144) at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039.doUpgrade(UpgradeTask_Build6039.java:95) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:673) at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:526) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:456) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:399) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:333) at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:100) at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:49) at com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:117) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:315) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:209) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:105) at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:30) at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:69) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:33) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:64) at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:54) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:UPDATE userassociation SET SOURCE_NAME = ? WHERE SINK_NODE_ID=? AND SINK_NODE_ENTITY=? AND ASSOCIATION_TYPE=? (Duplicate entry 'przemyslaw.marcinows-24682-Issue-WatchIssue' for key 'PRIMARY') at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:650) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.bulkUpdateByAnd(DefaultOfBizDelegator.java:685) ... 37 more {code} I had to {code} ALTER TABLE jira.userassociation DROP PRIMARY KEY; {code} and then upgrade proceeded to the sucessful end. {code} SELECT COUNT(*), SOURCE_NAME, SINK_NODE_ID FROM jira.userassociation GROUP BY SOURCE_NAME, SINK_NODE_ID HAVING COUNT(*)>1; {code} Results with hundreds of duplicated rows which prevents me from recreating primary key back again.

    Atlassian JIRA | 4 years ago | Matt
    com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:UPDATE userassociation SET SOURCE_NAME = ? WHERE SINK_NODE_ID=? AND SINK_NODE_ENTITY=? AND ASSOCIATION_TYPE=? (Duplicate entry 'przemyslaw.marcinows-24682-Issue-WatchIssue' for key 'PRIMARY')
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.ofbiz.core.entity.GenericDataSourceException

      SQL Exception while executing the following:UPDATE userassociation SET SOURCE_NAME = ? WHERE SINK_NODE_ID=? AND SINK_NODE_ENTITY=? AND ASSOCIATION_TYPE=? (Duplicate entry 'przemyslaw.marcinows-24682-Issue-WatchIssue' for key 'PRIMARY')

      at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate()
    2. org.ofbiz.core
      SQLProcessor.executeUpdate
      1. org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:650)
      1 frame
    3. com.atlassian.jira
      LauncherContextListener.contextInitialized
      1. com.atlassian.jira.ofbiz.DefaultOfBizDelegator.bulkUpdateByAnd(DefaultOfBizDelegator.java:685)
      2. com.atlassian.jira.entity.Update$WhereContext.execute(Update.java:136)
      3. com.atlassian.jira.entity.EntityEngineImpl.execute(EntityEngineImpl.java:45)
      4. com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039$AssociationVisitor.lowercaseThisRow(UpgradeTask_Build6039.java:250)
      5. com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039$AssociationVisitor.visit(UpgradeTask_Build6039.java:218)
      6. com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039$AssociationVisitor.visit(UpgradeTask_Build6039.java:193)
      7. com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl$3.consume(SelectQueryImpl.java:147)
      8. com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:129)
      9. com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.visitWith(SelectQueryImpl.java:142)
      10. com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039.updateNamesToLowercase(UpgradeTask_Build6039.java:174)
      11. com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039.updateSimpleColumn(UpgradeTask_Build6039.java:144)
      12. com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6039.doUpgrade(UpgradeTask_Build6039.java:95)
      13. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:673)
      14. com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:526)
      15. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:456)
      16. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:399)
      17. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:333)
      18. com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:100)
      19. com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:49)
      20. com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:117)
      21. com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:315)
      22. com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:209)
      23. com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:105)
      24. com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:30)
      25. com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:69)
      26. com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:33)
      27. com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:64)
      28. com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:54)
      28 frames
    4. Glassfish Core
      ContainerBase$StartChild.call
      1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
      2. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
      3. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      4. org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
      5. org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
      5 frames
    5. Java RT
      Thread.run
      1. java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      2. java.util.concurrent.FutureTask.run(Unknown Source)
      3. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      4. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      5. java.lang.Thread.run(Unknown Source)
      5 frames