com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,64016][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016][downgradetaskrequired,Y][id,10700][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory")) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172)

Atlassian JIRA | Mauro Fernandez Badii [Atlassian] | 10 months ago
  1. 0

    h3. Summary During a JIRA import, if the export is from a JIRA that has a pending upgrade task in the database, this entry is migrated and causes the JIRA Upgrade task (after the import) to fail and permanently Lock JIRA. h3. Steps to Reproduce Upgrade Tasks may appear as "Pending" in the *upgradehistory* db table if the DelayedUpgradeJobRunner introduced in JIRA 6.4 delayed the task. # Export a JIRA that has a "Pending" task in the *upgradehistory* table. # Import to latest JIRA h3. Expected Results JIRA imports and runs upgrade tasks h3. Actual Results JIRA imports data but fails to run upgrade tasks with the following error in the logs: {noformat} 2016-02-18 11:55:59.008981500 2016-02-18 11:55:59,008 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.ConsistencyCheckImpl] Could not find Mail Queue Service, adding. 2016-02-18 11:55:59.026175500 2016-02-18 11:55:59,026 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.ConsistencyCheckImpl] The Server ID for this JIRA instance is: [BJEV-O0EK-BZH3-N1YN] 2016-02-18 11:55:59.026836500 2016-02-18 11:55:59,026 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Importing data is 92% complete... 2016-02-18 11:55:59.265240500 2016-02-18 11:55:59,265 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Detected that an upgrade is needed; existing data at build 64015 2016-02-18 11:55:59.265681500 2016-02-18 11:55:59,265 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] ___ Performing Upgrade ____________________ 2016-02-18 11:55:59.368595500 2016-02-18 11:55:59,368 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Performing Upgrade Task: Drops the entityproperty_identity index in entity_property table 2016-02-18 11:55:59.376612500 2016-02-18 11:55:59,374 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Problem adding upgrade task Drops the entityproperty_identity index in entity_property table to the upgrade history 2016-02-18 11:55:59.376614500 com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,64016][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016][downgradetaskrequired,Y][id,10700][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory")) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172) 2016-02-18 11:55:59.376633500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:859) 2016-02-18 11:55:59.376633500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:726) 2016-02-18 11:55:59.376633500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:609) 2016-02-18 11:55:59.376634500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:493) 2016-02-18 11:55:59.376637500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:435) 2016-02-18 11:55:59.376637500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:379) 2016-02-18 11:55:59.376638500 at com.atlassian.jira.bc.dataimport.DefaultDataImportService.upgradeJira(DefaultDataImportService.java:833) 2016-02-18 11:55:59.376638500 at com.atlassian.jira.bc.dataimport.DefaultDataImportService.performImport(DefaultDataImportService.java:739) 2016-02-18 11:55:59.376641500 at com.atlassian.jira.bc.dataimport.DefaultDataImportService.doImport(DefaultDataImportService.java:320) 2016-02-18 11:55:59.376642500 at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.importJiraExportData(StudioDataImportAsyncCommand.java:182) 2016-02-18 11:55:59.376647500 at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.importDataAndFiles(StudioDataImportAsyncCommand.java:169) 2016-02-18 11:55:59.376648500 at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.call(StudioDataImportAsyncCommand.java:120) 2016-02-18 11:55:59.376649500 at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.call(StudioDataImportAsyncCommand.java:61) 2016-02-18 11:55:59.376656500 at com.atlassian.jira.task.ImportTaskManagerImpl$TaskCallableDecorator.call(ImportTaskManagerImpl.java:157) 2016-02-18 11:55:59.376656500 at com.atlassian.jira.task.ImportTaskManagerImpl$TaskCallableDecorator.call(ImportTaskManagerImpl.java:133) 2016-02-18 11:55:59.376657500 at java.util.concurrent.FutureTask.run(FutureTask.java:266) 2016-02-18 11:55:59.376657500 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 2016-02-18 11:55:59.376668500 at java.util.concurrent.FutureTask.run(FutureTask.java:266) 2016-02-18 11:55:59.376669500 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 2016-02-18 11:55:59.376669500 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 2016-02-18 11:55:59.376670500 at java.lang.Thread.run(Thread.java:745) 2016-02-18 11:55:59.376670500 Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,64016][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016][downgradetaskrequired,Y][id,10700][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory")) 2016-02-18 11:55:59.376682500 at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:213) 2016-02-18 11:55:59.376683500 at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:178) 2016-02-18 11:55:59.376683500 at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83) 2016-02-18 11:55:59.376683500 at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:556) 2016-02-18 11:55:59.376684500 at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:542) 2016-02-18 11:55:59.376684500 at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296) 2016-02-18 11:55:59.376687500 ... 22 more 2016-02-18 11:55:59.376687500 Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory") 2016-02-18 11:55:59.376692500 at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:683) 2016-02-18 11:55:59.376692500 at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:205) 2016-02-18 11:55:59.376695500 ... 28 more 2016-02-18 11:55:59.376696500 Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_upgradehistory" 2016-02-18 11:55:59.376696500 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2077) 2016-02-18 11:55:59.376697500 at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) 2016-02-18 11:55:59.376697500 at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:498) 2016-02-18 11:55:59.376700500 at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:386) 2016-02-18 11:55:59.376700500 at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:332) 2016-02-18 11:55:59.376701500 at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) 2016-02-18 11:55:59.376705500 at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) 2016-02-18 11:55:59.376706500 at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:673) 2016-02-18 11:55:59.376706500 ... 29 more 2016-02-18 11:55:59.384740500 2016-02-18 11:55:59,384 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Errors occurred during upgrade: 2016-02-18 11:55:59.384987500 2016-02-18 11:55:59,384 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Upgrade Error: There was a problem adding Upgrade Task Drops the entityproperty_identity index in entity_property table to the Upgrade History. This means the state of the system may be out of sync with the upgrade history, which could result in missed downgrade tasks for future exports. 2016-02-18 11:55:59.385238500 2016-02-18 11:55:59,385 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Importing data is 96% complete... 2016-02-18 11:55:59.388671500 2016-02-18 11:55:59,388 JiraImportTaskExecutionThread-1 WARN sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.p.d.dao.impl.CachingOrganizationDaoImpl] onImportCompleted - clearing cache !! 2016-02-18 11:55:59.389198500 2016-02-18 11:55:59,389 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Importing data is 100% complete... 2016-02-18 11:55:59.389351500 2016-02-18 11:55:59,389 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] JIRA Data Import has finished. 2016-02-18 11:55:59.389574500 2016-02-18 11:55:59,389 JiraImportTaskExecutionThread-1 WARN sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.studio.importer.StudioImport] FULL JIRA Import result is not valid. 2016-02-18 11:55:59.391667500 2016-02-18 11:55:59,391 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.studio.importer.StudioImport] Import finished I found the following entry on the entities.xml {noformat} JIRA is locked. h3. Notes On that particular case the following entry is found in the "entities.xml" {noformat} <UpgradeHistory id="10639" upgradeclass="com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016" targetbuild="64016" status="pending"/> {noformat} The export was from a JIRA build 64016 h3.Workaround * Search for the UpgradeTask_Build number in the entities.xml * If it is in "Pending" status, remove the entry and any other "Pending" tasks. * Recover JIRA and import again

    Atlassian JIRA | 10 months ago | Mauro Fernandez Badii [Atlassian]
    com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,64016][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016][downgradetaskrequired,Y][id,10700][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory")) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172)
  2. 0

    h3. Summary During a JIRA import, if the export is from a JIRA that has a pending upgrade task in the database, this entry is migrated and causes the JIRA Upgrade task (after the import) to fail and permanently Lock JIRA. h3. Steps to Reproduce Upgrade Tasks may appear as "Pending" in the *upgradehistory* db table if the DelayedUpgradeJobRunner introduced in JIRA 6.4 delayed the task. # Export a JIRA that has a "Pending" task in the *upgradehistory* table. # Import to latest JIRA h3. Expected Results JIRA imports and runs upgrade tasks h3. Actual Results *Update: 7/7/2016* - JIRA will allow the export, but will raise a validation error before beginning to import the backup file. This should allow the workaround to be applied directly and the import restarted. Under the previous behaviour JIRA imports data but fails to run upgrade tasks with the following error in the logs: {noformat} 2016-02-18 11:55:59.008981500 2016-02-18 11:55:59,008 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.ConsistencyCheckImpl] Could not find Mail Queue Service, adding. 2016-02-18 11:55:59.026175500 2016-02-18 11:55:59,026 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.ConsistencyCheckImpl] The Server ID for this JIRA instance is: [BJEV-O0EK-BZH3-N1YN] 2016-02-18 11:55:59.026836500 2016-02-18 11:55:59,026 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Importing data is 92% complete... 2016-02-18 11:55:59.265240500 2016-02-18 11:55:59,265 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Detected that an upgrade is needed; existing data at build 64015 2016-02-18 11:55:59.265681500 2016-02-18 11:55:59,265 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] ___ Performing Upgrade ____________________ 2016-02-18 11:55:59.368595500 2016-02-18 11:55:59,368 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Performing Upgrade Task: Drops the entityproperty_identity index in entity_property table 2016-02-18 11:55:59.376612500 2016-02-18 11:55:59,374 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Problem adding upgrade task Drops the entityproperty_identity index in entity_property table to the upgrade history 2016-02-18 11:55:59.376614500 com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,64016][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016][downgradetaskrequired,Y][id,10700][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory")) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172) 2016-02-18 11:55:59.376633500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:859) 2016-02-18 11:55:59.376633500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:726) 2016-02-18 11:55:59.376633500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:609) 2016-02-18 11:55:59.376634500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:493) 2016-02-18 11:55:59.376637500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:435) 2016-02-18 11:55:59.376637500 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:379) 2016-02-18 11:55:59.376638500 at com.atlassian.jira.bc.dataimport.DefaultDataImportService.upgradeJira(DefaultDataImportService.java:833) 2016-02-18 11:55:59.376638500 at com.atlassian.jira.bc.dataimport.DefaultDataImportService.performImport(DefaultDataImportService.java:739) 2016-02-18 11:55:59.376641500 at com.atlassian.jira.bc.dataimport.DefaultDataImportService.doImport(DefaultDataImportService.java:320) 2016-02-18 11:55:59.376642500 at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.importJiraExportData(StudioDataImportAsyncCommand.java:182) 2016-02-18 11:55:59.376647500 at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.importDataAndFiles(StudioDataImportAsyncCommand.java:169) 2016-02-18 11:55:59.376648500 at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.call(StudioDataImportAsyncCommand.java:120) 2016-02-18 11:55:59.376649500 at com.atlassian.jira.studio.importer.StudioDataImportAsyncCommand.call(StudioDataImportAsyncCommand.java:61) 2016-02-18 11:55:59.376656500 at com.atlassian.jira.task.ImportTaskManagerImpl$TaskCallableDecorator.call(ImportTaskManagerImpl.java:157) 2016-02-18 11:55:59.376656500 at com.atlassian.jira.task.ImportTaskManagerImpl$TaskCallableDecorator.call(ImportTaskManagerImpl.java:133) 2016-02-18 11:55:59.376657500 at java.util.concurrent.FutureTask.run(FutureTask.java:266) 2016-02-18 11:55:59.376657500 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 2016-02-18 11:55:59.376668500 at java.util.concurrent.FutureTask.run(FutureTask.java:266) 2016-02-18 11:55:59.376669500 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 2016-02-18 11:55:59.376669500 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 2016-02-18 11:55:59.376670500 at java.lang.Thread.run(Thread.java:745) 2016-02-18 11:55:59.376670500 Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,64016][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016][downgradetaskrequired,Y][id,10700][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory")) 2016-02-18 11:55:59.376682500 at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:213) 2016-02-18 11:55:59.376683500 at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:178) 2016-02-18 11:55:59.376683500 at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83) 2016-02-18 11:55:59.376683500 at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:556) 2016-02-18 11:55:59.376684500 at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:542) 2016-02-18 11:55:59.376684500 at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296) 2016-02-18 11:55:59.376687500 ... 22 more 2016-02-18 11:55:59.376687500 Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory") 2016-02-18 11:55:59.376692500 at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:683) 2016-02-18 11:55:59.376692500 at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:205) 2016-02-18 11:55:59.376695500 ... 28 more 2016-02-18 11:55:59.376696500 Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_upgradehistory" 2016-02-18 11:55:59.376696500 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2077) 2016-02-18 11:55:59.376697500 at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) 2016-02-18 11:55:59.376697500 at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:498) 2016-02-18 11:55:59.376700500 at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:386) 2016-02-18 11:55:59.376700500 at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:332) 2016-02-18 11:55:59.376701500 at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) 2016-02-18 11:55:59.376705500 at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) 2016-02-18 11:55:59.376706500 at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:673) 2016-02-18 11:55:59.376706500 ... 29 more 2016-02-18 11:55:59.384740500 2016-02-18 11:55:59,384 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Errors occurred during upgrade: 2016-02-18 11:55:59.384987500 2016-02-18 11:55:59,384 JiraImportTaskExecutionThread-1 ERROR sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.jira.upgrade.UpgradeManagerImpl] Upgrade Error: There was a problem adding Upgrade Task Drops the entityproperty_identity index in entity_property table to the Upgrade History. This means the state of the system may be out of sync with the upgrade history, which could result in missed downgrade tasks for future exports. 2016-02-18 11:55:59.385238500 2016-02-18 11:55:59,385 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Importing data is 96% complete... 2016-02-18 11:55:59.388671500 2016-02-18 11:55:59,388 JiraImportTaskExecutionThread-1 WARN sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.p.d.dao.impl.CachingOrganizationDaoImpl] onImportCompleted - clearing cache !! 2016-02-18 11:55:59.389198500 2016-02-18 11:55:59,389 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] Importing data is 100% complete... 2016-02-18 11:55:59.389351500 2016-02-18 11:55:59,389 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.bc.dataimport.DefaultDataImportService] JIRA Data Import has finished. 2016-02-18 11:55:59.389574500 2016-02-18 11:55:59,389 JiraImportTaskExecutionThread-1 WARN sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.studio.importer.StudioImport] FULL JIRA Import result is not valid. 2016-02-18 11:55:59.391667500 2016-02-18 11:55:59,391 JiraImportTaskExecutionThread-1 INFO sysadmin 712x574x1 2fzgw2 103.233.242.8,165.254.227.130,127.0.0.1 /secure/admin/StudioImport!import.jspa [c.a.j.studio.importer.StudioImport] Import finished I found the following entry on the entities.xml {noformat} JIRA is locked. h3. Notes On that particular case the following entry is found in the "entities.xml" {noformat} <UpgradeHistory id="10639" upgradeclass="com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016" targetbuild="64016" status="pending"/> {noformat} The export was from a JIRA build 64016 h3.Workaround * Search for the UpgradeTask_Build number in the entities.xml * If it is in "Pending" status, remove the entry and any other "Pending" tasks. * Recover JIRA and import again

    Atlassian JIRA | 10 months ago | Mauro Fernandez Badii [Atlassian]
    com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,64016][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016][downgradetaskrequired,Y][id,10700][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory")) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172)
  3. 0

    h3. Summary If the jira instance is restarted after adding an entry for a delayed upgrade task in the database, but before it's complete, it can end up in an invalid state whereby on next boot, it will try to add the delayed upgrade task again and fail due to a public key conflict. h3. Steps to Reproduce. # Have a database with values from an older version of JIRA. # Update to a version of JIRA where the last upgrade task is a delayed upgrade task. # Stop jira after the entry has been added into the database about the upgrade task, but before it has completed. # Try to start JIRA up again. h3. Expected Results. JIRA starts up fine and the delayed upgrade task runs at the next reasonable time. h3. Actual Results JIRA breaks and needs manual database entry changes before it'll work again. h3. Notes log: {code:java} @40000000578dad371fcc7ae4 2016-07-19 14:31:41,533 localhost-startStop-1 INFO [c.a.jira.upgrade.UpgradeManagerImpl] ___ Performing Upgrade ____________________ @40000000578dad3a06c34ce4 2016-07-19 14:31:44,113 localhost-startStop-1 INFO [c.a.jira.upgrade.UpgradeManagerImpl] Performing Upgrade Task: Populating entity_translation table @40000000578dad3a0ca8edbc 2016-07-19 14:31:44,212 localhost-startStop-1 INFO [c.a.j.upgrade.tasks.UpgradeTask_Build100005] Migrated IssueType translations: count=2 @40000000578dad3a0e38387c 2016-07-19 14:31:44,238 localhost-startStop-1 INFO [c.a.j.upgrade.tasks.UpgradeTask_Build100005] Migrated CustomField translations: count=1 @40000000578dad3a11153cd4 2016-07-19 14:31:44,280 localhost-startStop-1 ERROR [c.a.jira.upgrade.UpgradeManagerImpl] Problem adding upgrade task Populating entity_translation table to the upgrade history @40000000578dad3a1115488c com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,100005][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005][downgradetaskrequired,N][id,19900][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory" @40000000578dad3a111592c4 Detail: Key (upgradeclass)=(com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005) already exists.)) @40000000578dad3a111596ac at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) @40000000578dad3a11159a94 at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172) @40000000578dad3a11159e7c at com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:855) @40000000578dad3a1115b204 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:722) @40000000578dad3a1115b5ec at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:605) @40000000578dad3a1115b9d4 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:489) @40000000578dad3a1115bdbc at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:431) @40000000578dad3a1115c58c at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:375) @40000000578dad3a1115c974 at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:90) @40000000578dad3a1115cd5c at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:47) @40000000578dad3a1115d144 at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:46) @40000000578dad3a1115d914 at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postTenantArrived$4(DefaultJiraLauncher.java:178) @40000000578dad3a1115dcfc at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$572/18195594.run(Unknown Source) @40000000578dad3a1115f084 at com.atlassian.jira.startup.DefaultInstantUpgradeManager$StartupTask.run(DefaultInstantUpgradeManager.java:139) @40000000578dad3a1115f46c at com.atlassian.jira.startup.DefaultInstantUpgradeManager.runTask(DefaultInstantUpgradeManager.java:55) @40000000578dad3a1115f854 at com.atlassian.jira.startup.DefaultInstantUpgradeManager.doNowOrWhenInstanceBecomesActive(DefaultInstantUpgradeManager.java:42) @40000000578dad3a1116040c at com.atlassian.jira.startup.DefaultJiraLauncher.postTenantArrived(DefaultJiraLauncher.java:171) @40000000578dad3a1116040c at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDBActivated$3(DefaultJiraLauncher.java:159) @40000000578dad3a111607f4 at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$571/15549038.run(Unknown Source) @40000000578dad3a111613ac at com.atlassian.jira.tenancy.DefaultTenantManager.doNowOrWhenTenantArrives(DefaultTenantManager.java:55) @40000000578dad3a11161794 at com.atlassian.jira.startup.DefaultJiraLauncher.postDBActivated(DefaultJiraLauncher.java:156) @40000000578dad3a11161b7c at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$2(DefaultJiraLauncher.java:145) @40000000578dad3a11161f64 at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$16/1490463.run(Unknown Source) @40000000578dad3a1116522c at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298) @40000000578dad3a11165614 at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194) @40000000578dad3a111659fc at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:135) @40000000578dad3a111665b4 at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:101) @40000000578dad3a1116699c at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$4/3748190.run(Unknown Source) @40000000578dad3a11166d84 at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31) @40000000578dad3a11166d84 at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:99) @40000000578dad3a1116793c at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:146) @40000000578dad3a11167d24 at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:94) @40000000578dad3a1116810c ... 8 filtered @40000000578dad3a1116810c at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) @40000000578dad3a111690ac at java.util.concurrent.FutureTask.run(FutureTask.java:266) @40000000578dad3a111690ac at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) @40000000578dad3a11169494 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) @40000000578dad3a1116987c at java.lang.Thread.run(Thread.java:745) @40000000578dad3a1116987c Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,100005][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005][downgradetaskrequired,N][id,19900][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory" @40000000578dad3a1116afec Detail: Key (upgradeclass)=(com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005) already exists.)) @40000000578dad3a1116b3d4 at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:213) @40000000578dad3a1116b7bc at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:178) @40000000578dad3a1116c75c at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83) @40000000578dad3a1116c75c at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:556) @40000000578dad3a1116cb44 at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:97) @40000000578dad3a1116cf2c at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296) @40000000578dad3a1116cf2c ... 44 more @40000000578dad3a1116dae4 Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory" @40000000578dad3a1116e2b4 Detail: Key (upgradeclass)=(com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005) already exists.) @40000000578dad3a1116e69c at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:683) @40000000578dad3a1116f254 at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:205) @40000000578dad3a1116f254 ... 50 more @40000000578dad3a1116f63c Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_upgradehistory" @40000000578dad3a111705dc at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157) @40000000578dad3a111709c4 at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886) @40000000578dad3a11170dac at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) @40000000578dad3a11170dac at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555) @40000000578dad3a1117251c at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417) @40000000578dad3a11172904 at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363) @40000000578dad3a11172cec ... 2 filtered @40000000578dad3a11172cec at java.lang.reflect.Method.invoke(Method.java:497) @40000000578dad3a111730d4 at com.github.gquintana.metrics.proxy.MethodInvocation.proceed(MethodInvocation.java:75) @40000000578dad3a11173c8c at com.github.gquintana.metrics.sql.PreparedStatementProxyHandler.execute(PreparedStatementProxyHandler.java:55) @40000000578dad3a11174074 at com.github.gquintana.metrics.sql.AbstractStatementProxyHandler.invoke(AbstractStatementProxyHandler.java:61) @40000000578dad3a1117445c at com.github.gquintana.metrics.proxy.ProxyHandler.invoke(ProxyHandler.java:73) @40000000578dad3a1117445c at com.sun.proxy.$Proxy3.executeUpdate(Unknown Source) @40000000578dad3a11175bcc at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) @40000000578dad3a11175fb4 at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:97) @40000000578dad3a1117639c at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:673) @40000000578dad3a11176784 ... 51 more @40000000578dad3a11dc326c 2016-07-19 14:31:44,299 localhost-startStop-1 ERROR [c.a.jira.upgrade.UpgradeManagerImpl] Errors occurred during upgrade: @40000000578dad3a11ddc8ac 2016-07-19 14:31:44,299 localhost-startStop-1 ERROR [c.a.jira.upgrade.UpgradeManagerImpl] Upgrade Error: There was a problem adding Upgrade Task Populating entity_translation table to the Upgrade History. This means the state of the system may be out of sync with the upgrade history, which could result in missed downgrade tasks for future exports. {code} h3. Workaround: Deleting the entry in upgradehistory and restarting the instance makes it start up fine.

    Atlassian JIRA | 4 months ago | Alex Radu
    com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,100005][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005][downgradetaskrequired,N][id,19900][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory" @40000000578dad3a111592c4 Detail: Key (upgradeclass)=(com.atlassian.jira.upgrade.tasks.UpgradeTask_Build100005) already exists.)) @40000000578dad3a111596ac at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) @40000000578dad3a11159a94 at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172) @40000000578dad3a11159e7c at com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:855) @40000000578dad3a1115b204 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:722) @40000000578dad3a1115b5ec at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:605) @40000000578dad3a1115b9d4 at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:489) @40000000578dad3a1115bdbc at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:431) @40000000578dad3a1115c58c at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:375) @40000000578dad3a1115c974 at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:90) @40000000578dad3a1115cd5c at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:47) @40000000578dad3a1115d144 at com.atlassian.jira.startup.ActiveServicesLauncher.start(ActiveServicesLauncher.java:46) @40000000578dad3a1115d914 at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postTenantArrived$4(DefaultJiraLauncher.java:178) @40000000578dad3a1115dcfc at com.atlassian.jira.startup.DefaultJiraLauncher$$Lambda$572/18195594.run(Unknown Source) @40000000578dad3a1115f084 at com.atlassian.jira.startup.DefaultInstantUpgradeManager$StartupTask.run(DefaultInstantUpgradeManager.java:139) @40000000578dad3a1115f46c at com.atlassian.jira.startup.DefaultInstantUpgradeManager.runTask(DefaultInstantUpgradeManager.java:55) @40000000578dad3a1115f854 at com.atlassian.jira.startup.DefaultInstantUpgradeManager.doNowOrWhenInstanceBecomesActive(DefaultInstantUpgradeManager.java:42)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 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 | 10 months 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]))
  6. 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 | 10 months 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]))

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.atlassian.jira.exception.DataAccessException

      org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:UpgradeHistory][targetbuild,64016][upgradeclass,com.atlassian.jira.upgrade.tasks.UpgradeTask_Build64016][downgradetaskrequired,Y][id,10700][status,complete] (SQL Exception while executing the following:INSERT INTO public.upgradehistory (ID, UPGRADECLASS, TARGETBUILD, STATUS, DOWNGRADETASKREQUIRED) VALUES (?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_upgradehistory")) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299) 2016-02-18 11:55:59.376628500 at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172)

      at com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory()
    2. com.atlassian.jira
      UpgradeManagerImpl.runUpgradeTasks
      1. com.atlassian.jira.upgrade.UpgradeManagerImpl.addToUpgradeHistory(UpgradeManagerImpl.java:859)
      2. com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:726)
      3. com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:609)
      3 frames