com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,70109][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109][downgradetaskrequired,N][id,10800][status,complete] (SQL Exception while executing the following:INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) [23505-185]))

Atlassian JIRA | Daniel Leng | 1 year ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    h3. Summary Upgrading to JIRA 7 while using the built-in (in-memory) database fails with error: {code} problem adding Upgrade Task Deleting invalid version associations {code} h3. Environment * This affects the migration from HSQL to H2. H2 is the new built-in database introduced in JIRA7, while HSQL has been in use across all versions prior to JIRA7. * JIRA will need to perform some migration steps to move from HSQL to H2. (this is done automatically during upgrade) * Effectively, this means the bug affects any customer currently using the internal HSQL database and is upgrading to JIRA 7.0 or newer. h3. Steps to Reproduce # Install JIRA 6.4.11 using the installer. Complete the setup process through the browser as well, then shut down JIRA. # Upgrade the installation in step 1 using any JIRA 7.0.x version installer. # At one point during the migration from HSQL to H2 procedure (you can track this in the logs), you will be asked to restart: {code} 2016-01-12 23:33:58,362 localhost-startStop-1 WARN [c.a.jira.startup.EmbeddedDatabaseMigrator] ***************************************************** JIRA must be restarted to complete the import process ***************************************************** Please restart JIRA to complete the HSQL to H2 database migration {code} (i) The UI will also inform you that you need to restart JIRA. [^Restart.png] h3. Expected Results The Upgrade completes successfully after the restart and you can access JIRA. h3. Actual Results After restarting, JIRA fails to start up correctly and gets locked. The below exception is thrown in the atlassian-jira.log file: {noformat} 2016-01-12 23:37:16,625 localhost-startStop-1 ERROR [c.a.jira.upgrade.UpgradeManagerImpl] Upgrade Error: There was a problem adding Upgrade Task Deleting invalid version associations. to the Upgrade History 2016-01-12 23:37:16,626 localhost-startStop-1 WARN [c.a.j.p.d.dao.impl.CachingOrganizationDaoImpl] onImportCompleted - clearing cache !! 2016-01-12 23:37:16,627 localhost-startStop-1 INFO [c.a.j.bc.dataimport.DefaultDataImportService] JIRA Data Import has finished. 2016-01-12 23:37:16,629 localhost-startStop-1 ERROR [c.a.jira.startup.LauncherContextListener] Unable to start JIRA. java.lang.RuntimeException: com.atlassian.core.AtlassianCoreException: Error messages: Errors: Import error: UPGRADE_EXCEPTION - There was a problem adding Upgrade Task Deleting invalid version associations. to the Upgrade History at com.atlassian.jira.startup.EmbeddedDatabaseMigrator.importAndContinue(EmbeddedDatabaseMigrator.java:139) at com.atlassian.jira.startup.EmbeddedDatabaseMigrator.start(EmbeddedDatabaseMigrator.java:57) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$473(DefaultJiraLauncher.java:136) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:120) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$471(DefaultJiraLauncher.java:89) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:87) at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:79) ... 5 filtered at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.atlassian.core.AtlassianCoreException: Error messages: Errors: Import error: UPGRADE_EXCEPTION - There was a problem adding Upgrade Task Deleting invalid version associations. to the Upgrade History at com.atlassian.jira.startup.EmbeddedDatabaseMigrator.importAndContinue(EmbeddedDatabaseMigrator.java:138) 12-Jan-2016 23:37:16.935 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 12-Jan-2016 23:37:16.948 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 125161 ms {noformat} {code:java} 2016-01-15 13:09:07,650 localhost-startStop-1 ERROR [c.a.jira.upgrade.UpgradeManagerImpl] Problem adding upgrade task Deleting invalid version associations. to the upgrade history com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,70109][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109][downgradetaskrequired,N][id,10800][status,complete] (SQL Exception while executing the following:INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) [23505-185])) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172) at com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:832) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:706) at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:589) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:473) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:415) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:359) at com.atlassian.jira.bc.dataimport.DefaultDataImportService.upgradeJira(DefaultDataImportService.java:825) at com.atlassian.jira.bc.dataimport.DefaultDataImportService.performImport(DefaultDataImportService.java:731) at com.atlassian.jira.bc.dataimport.DefaultDataImportService.doImport(DefaultDataImportService.java:312) at com.atlassian.jira.startup.EmbeddedDatabaseMigrator.importAndContinue(EmbeddedDatabaseMigrator.java:122) at com.atlassian.jira.startup.EmbeddedDatabaseMigrator.start(EmbeddedDatabaseMigrator.java:57) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$473(DefaultJiraLauncher.java:136) at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$14/2138019066.run(Unknown Source) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:120) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$471(DefaultJiraLauncher.java:89) at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$1/84029026.run(Unknown Source) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:87) at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:79) ... 5 filtered at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,70109][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109][downgradetaskrequired,N][id,10800][status,complete] (SQL Exception while executing the following:INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) [23505-185])) at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:213) at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:178) at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83) at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:556) at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:97) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296) ... 31 more Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) [23505-185]) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:684) at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:205) ... 37 more Caused by: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:179) at org.h2.message.DbException.get(DbException.java:155) at org.h2.index.BaseIndex.getDuplicateKeyException(BaseIndex.java:102) at org.h2.mvstore.db.MVSecondaryIndex.add(MVSecondaryIndex.java:203) at org.h2.mvstore.db.MVTable.addRow(MVTable.java:637) at org.h2.command.dml.Insert.insertRows(Insert.java:156) at org.h2.command.dml.Insert.update(Insert.java:114) at org.h2.command.CommandContainer.update(CommandContainer.java:78) at org.h2.command.Command.executeUpdate(Command.java:254) at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:157) at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:143) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:674) ... 38 more {code} h3.Workaround # Restart a couple more times, (this is a *seemingly random behaviour*) and eventually JIRA is able to be started successfully without the error message OR # Use an external database instead OR # Try this process to restore from an automated XML backup: ** Stop your JIRA. ** Go to your {{<JIRAHOME>}} and delete *dbconfig.xml* and remove all the files from {{<JIRAHOME>/database}} directory. ** From {{<JIRAHOME>/import}} directory, remove *hsql-migration.zip*. ** Copy your latest automated backup file from {{<JIRAHOME>/export}} to {{<JIRAHOME>/import}} ** Restart your JIRA and choose to use in build database. ** In some cases JIRA would have restored your old data. If it's not restored, please restore the automated backup that you moved earlier using [this|https://confluence.atlassian.com/jira/restoring-data-185729565.html] method.

    Atlassian JIRA | 1 year ago | Daniel Leng [Atlassian]
    com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,70109][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109][downgradetaskrequired,N][id,10800][status,complete] (SQL Exception while executing the following:INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) [23505-185]))
  2. 0

    h3. Summary Upgrading to JIRA 7 while using the built-in (in-memory) database fails with error: {code} problem adding Upgrade Task Deleting invalid version associations {code} h3. Environment * This affects the migration from HSQL to H2. H2 is the new built-in database introduced in JIRA7, while HSQL has been in use across all versions prior to JIRA7. * JIRA will need to perform some migration steps to move from HSQL to H2. (this is done automatically during upgrade) * Effectively, this means the bug affects any customer currently using the internal HSQL database and is upgrading to JIRA 7.0 or newer. h3. Steps to Reproduce # Install JIRA 6.4.11 using the installer. Complete the setup process through the browser as well, then shut down JIRA. # Upgrade the installation in step 1 using any JIRA 7.0.x version installer. # At one point during the migration from HSQL to H2 procedure (you can track this in the logs), you will be asked to restart: {code} 2016-01-12 23:33:58,362 localhost-startStop-1 WARN [c.a.jira.startup.EmbeddedDatabaseMigrator] ***************************************************** JIRA must be restarted to complete the import process ***************************************************** Please restart JIRA to complete the HSQL to H2 database migration {code} (i) The UI will also inform you that you need to restart JIRA. [^Restart.png] h3. Expected Results The Upgrade completes successfully after the restart and you can access JIRA. h3. Actual Results After restarting, JIRA fails to start up correctly and gets locked. The below exception is thrown in the atlassian-jira.log file: {noformat} 2016-01-12 23:37:16,625 localhost-startStop-1 ERROR [c.a.jira.upgrade.UpgradeManagerImpl] Upgrade Error: There was a problem adding Upgrade Task Deleting invalid version associations. to the Upgrade History 2016-01-12 23:37:16,626 localhost-startStop-1 WARN [c.a.j.p.d.dao.impl.CachingOrganizationDaoImpl] onImportCompleted - clearing cache !! 2016-01-12 23:37:16,627 localhost-startStop-1 INFO [c.a.j.bc.dataimport.DefaultDataImportService] JIRA Data Import has finished. 2016-01-12 23:37:16,629 localhost-startStop-1 ERROR [c.a.jira.startup.LauncherContextListener] Unable to start JIRA. java.lang.RuntimeException: com.atlassian.core.AtlassianCoreException: Error messages: Errors: Import error: UPGRADE_EXCEPTION - There was a problem adding Upgrade Task Deleting invalid version associations. to the Upgrade History at com.atlassian.jira.startup.EmbeddedDatabaseMigrator.importAndContinue(EmbeddedDatabaseMigrator.java:139) at com.atlassian.jira.startup.EmbeddedDatabaseMigrator.start(EmbeddedDatabaseMigrator.java:57) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$473(DefaultJiraLauncher.java:136) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:120) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$471(DefaultJiraLauncher.java:89) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:87) at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:79) ... 5 filtered at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.atlassian.core.AtlassianCoreException: Error messages: Errors: Import error: UPGRADE_EXCEPTION - There was a problem adding Upgrade Task Deleting invalid version associations. to the Upgrade History at com.atlassian.jira.startup.EmbeddedDatabaseMigrator.importAndContinue(EmbeddedDatabaseMigrator.java:138) 12-Jan-2016 23:37:16.935 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 12-Jan-2016 23:37:16.948 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 125161 ms {noformat} {code:java} 2016-01-15 13:09:07,650 localhost-startStop-1 ERROR [c.a.jira.upgrade.UpgradeManagerImpl] Problem adding upgrade task Deleting invalid version associations. to the upgrade history com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,70109][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109][downgradetaskrequired,N][id,10800][status,complete] (SQL Exception while executing the following:INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) [23505-185])) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172) at com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:832) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:706) at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:589) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:473) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:415) at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:359) at com.atlassian.jira.bc.dataimport.DefaultDataImportService.upgradeJira(DefaultDataImportService.java:825) at com.atlassian.jira.bc.dataimport.DefaultDataImportService.performImport(DefaultDataImportService.java:731) at com.atlassian.jira.bc.dataimport.DefaultDataImportService.doImport(DefaultDataImportService.java:312) at com.atlassian.jira.startup.EmbeddedDatabaseMigrator.importAndContinue(EmbeddedDatabaseMigrator.java:122) at com.atlassian.jira.startup.EmbeddedDatabaseMigrator.start(EmbeddedDatabaseMigrator.java:57) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$473(DefaultJiraLauncher.java:136) at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$14/2138019066.run(Unknown Source) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:120) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$471(DefaultJiraLauncher.java:89) at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$1/84029026.run(Unknown Source) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:87) at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:79) ... 5 filtered at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,70109][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109][downgradetaskrequired,N][id,10800][status,complete] (SQL Exception while executing the following:INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) [23505-185])) at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:213) at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:178) at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83) at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:556) at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:97) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296) ... 31 more Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) [23505-185]) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:684) at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:205) ... 37 more Caused by: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:179) at org.h2.message.DbException.get(DbException.java:155) at org.h2.index.BaseIndex.getDuplicateKeyException(BaseIndex.java:102) at org.h2.mvstore.db.MVSecondaryIndex.add(MVSecondaryIndex.java:203) at org.h2.mvstore.db.MVTable.addRow(MVTable.java:637) at org.h2.command.dml.Insert.insertRows(Insert.java:156) at org.h2.command.dml.Insert.update(Insert.java:114) at org.h2.command.CommandContainer.update(CommandContainer.java:78) at org.h2.command.Command.executeUpdate(Command.java:254) at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:157) at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:143) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:674) ... 38 more {code} h3.Workaround # Restart a couple more times, (this is a *seemingly random behaviour*) and eventually JIRA is able to be started successfully without the error message OR # Use an external database instead OR # Try this process to restore from an automated XML backup: ** Stop your JIRA. ** Go to your {{<JIRAHOME>}} and delete *dbconfig.xml* and remove all the files from {{<JIRAHOME>/database}} directory. ** From {{<JIRAHOME>/import}} directory, remove *hsql-migration.zip*. ** Copy your latest automated backup file from {{<JIRAHOME>/export}} to {{<JIRAHOME>/import}} ** Restart your JIRA and choose to use in build database. ** In some cases JIRA would have restored your old data. If it's not restored, please restore the automated backup that you moved earlier using [this|https://confluence.atlassian.com/jira/restoring-data-185729565.html] method.

    Atlassian JIRA | 1 year ago | Daniel Leng
    com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,70109][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109][downgradetaskrequired,N][id,10800][status,complete] (SQL Exception while executing the following:INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) [23505-185]))

    Root Cause Analysis

    1. com.atlassian.jira.exception.DataAccessException

      org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,70109][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109][downgradetaskrequired,N][id,10800][status,complete] (SQL Exception while executing the following:INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (Unique index or primary key violation: "PRIMARY_KEY_25 ON PUBLIC.UPGRADEHISTORY(UPGRADECLASS) VALUES ('com.atlassian.jira.upgrade.tasks.UpgradeTask_Build70109', 91)"; SQL statement: INSERT INTO PUBLIC.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) [23505-185]))

      at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue()
    2. com.atlassian.jira
      DefaultJiraLauncher.lambda$postDbLaunch$473
      1. com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299)
      2. com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172)
      3. com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:832)
      4. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:706)
      5. com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:589)
      6. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:473)
      7. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:415)
      8. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:359)
      9. com.atlassian.jira.bc.dataimport.DefaultDataImportService.upgradeJira(DefaultDataImportService.java:825)
      10. com.atlassian.jira.bc.dataimport.DefaultDataImportService.performImport(DefaultDataImportService.java:731)
      11. com.atlassian.jira.bc.dataimport.DefaultDataImportService.doImport(DefaultDataImportService.java:312)
      12. com.atlassian.jira.startup.EmbeddedDatabaseMigrator.importAndContinue(EmbeddedDatabaseMigrator.java:122)
      13. com.atlassian.jira.startup.EmbeddedDatabaseMigrator.start(EmbeddedDatabaseMigrator.java:57)
      14. com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$473(DefaultJiraLauncher.java:136)
      14 frames