JIRA Upgrade 5.2.10 -> 6.0.6: PRIMARY KEY 'PK_propertyentry restriction

hi,

I'm trying to upgrade my JIRA version 5.2.10 to version 6.0.6 and I get the following error when trying to start JIRA for the first time:

JIRA Access Constraints

You cannot access JIRA at present.
An error occurred performing JIRA upgrade

Exception thrown during upgrade: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:OSPropertyEntry][id,20715][entityId,1][propertyKey,jira.clone.link.legacy.direction][type,1][entityName,jira.properties] (SQL Exception while executing the following:INSERT INTO dbo.propertyentry (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, propertytype) VALUES (?, ?, ?, ?, ?) (Infracción de la restricción PRIMARY KEY 'PK_propertyentry'. No se puede insertar una clave duplicada en el objeto 'dbo.propertyentry'.))
com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:OSPropertyEntry][id,20715][entityId,1][propertyKey,jira.clone.link.legacy.direction][type,1][entityName,jira.properties] (SQL Exception while executing the following:INSERT INTO dbo.propertyentry (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, propertytype) VALUES (?, ?, ?, ?, ?) (Infracción de la restricción PRIMARY KEY 'PK_propertyentry'. No se puede insertar una clave duplicada en el objeto 'dbo.propertyentry'.))
	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:379)
	at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6085.setLegacyCloneDirectionProperty(UpgradeTask_Build6085.java:85)
	at com.atlassian.jira.upgrade.tasks.UpgradeTask_Build6085.doUpgrade(UpgradeTask_Build6085.java:57)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSuccess(UpgradeManagerImpl.java:673)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.runUpgradeTasks(UpgradeManagerImpl.java:526)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:456)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:399)
	at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:333)
	at com.atlassian.jira.upgrade.UpgradeLauncher.checkIfUpgradeNeeded(UpgradeLauncher.java:100)
	at com.atlassian.jira.upgrade.UpgradeLauncher.start(UpgradeLauncher.java:49)
	at com.atlassian.jira.startup.DefaultJiraLauncher$3.run(DefaultJiraLauncher.java:117)
	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:315)
	at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:209)
	at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:105)
	at com.atlassian.jira.startup.DefaultJiraLauncher.access$100(DefaultJiraLauncher.java:30)
	at com.atlassian.jira.startup.DefaultJiraLauncher$1.run(DefaultJiraLauncher.java:69)
	at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:33)
	at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:64)
	at com.atlassian.jira.startup.LauncherContextListener.contextInitialized(LauncherContextListener.java:54)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:OSPropertyEntry][id,20715][entityId,1][propertyKey,jira.clone.link.legacy.direction][type,1][entityName,jira.properties] (SQL Exception while executing the following:INSERT INTO dbo.propertyentry (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, propertytype) VALUES (?, ?, ?, ?, ?) (Infracción de la restricción PRIMARY KEY 'PK_propertyentry'. No se puede insertar una clave duplicada en el objeto 'dbo.propertyentry'.))
	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:136)
	at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:101)
	at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:64)
	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:487)
	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:467)
	at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:98)
	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:374)
	... 28 more

The error mentions that there is a primary key violation in the propertyentry table. I have checked the table and there is no duplicate ID.

Has anyone got an idea how to solve this?

thanks,

Jacques.

1 answer

1 accepted

0 vote
Yilin Mo Atlassian Team Aug 06, 2013

The upgrade task is trying to insert a new valeu, may be you can try to run the query to check whether the next sequence id is bigger than at least max (id) + 1 for propertyentry:

1. Check sequence id:

select * from SEQUENCE_VALUE_ITEM where SEQ_NAME = 'OSPropertyEntry';

2. Check the max id of the propertyentry:

select max(id) from propertyentry;

If this is not the case, try to put a bigger value for the frequence before upgrade procedure, hope this help.

Hi Yilin,

Sorry for the delay in replying! This did the job! I increased the OSPropertyEntry and this solved the issue!

thanks very much!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

772 views 2 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you