Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-41681

Project import aborted due to too many errors

    XMLWordPrintable

Details

    Description

      NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      While importing a project from a JIRA backup the import fails with the following error.

      The import was aborted because there were too many errors. Some errors are listed below. For full details about the errors please see your logs. Please note that some elements have been created. You may want to consult your logs to see what caused the errors, delete the project, and perform the import again.
      

      A few of the following errors can be found in the JIRA logs

      2015-01-17 15:01:50,542 ProjectImport: CreateIssueRelatedData-10 ERROR admin 901x156x1 4bmvmr 127.0.0.1 /secure/admin/ProjectImportSummary.jspa [jira.imports.project.DefaultProjectImportPersister] DataAccessException occured while trying to create Entity type 'EntityProperty' . {id=10031, entityName=IssueProperty, entityId=10115, propertyKey=request.channel.type, value="Portal", created=2015-01-08 18:51:44.178, updated=2015-01-08 18:51:44.178}
      com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:EntityProperty][id,10031][created,2015-01-08 18:51:44.178][updated,2015-01-08 18:51:44.178][entityId,10115][value,"Portal"][propertyKey,request.channel.type][entityName,IssueProperty] (SQL Exception while executing the following:INSERT INTO public.entity_property (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, CREATED, UPDATED, json_value) VALUES (?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_entity_property"
        Detail: Key (id)=(10031) already exists.))
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:397)
      	at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:219)
      	at com.atlassian.jira.imports.project.DefaultProjectImportPersister.createEntity(DefaultProjectImportPersister.java:192)
      	at com.atlassian.jira.imports.project.handler.EntityPropertiesPersisterHandler$1.run(EntityPropertiesPersisterHandler.java:63)
      	at com.atlassian.jira.util.concurrent.BoundedExecutor$1.run(BoundedExecutor.java:50)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
      	at java.lang.Thread.run(Thread.java:695)
      Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:EntityProperty][id,10031][created,2015-01-08 18:51:44.178][updated,2015-01-08 18:51:44.178][entityId,10115][value,"Portal"][propertyKey,request.channel.type][entityName,IssueProperty] (SQL Exception while executing the following:INSERT INTO public.entity_property (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, CREATED, UPDATED, json_value) VALUES (?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_entity_property"
        Detail: Key (id)=(10031) already exists.))
      	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:200)
      	at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:165)
      	at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83)
      	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:554)
      	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:540)
      	at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:98)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:392)
      	... 7 more
      

      Steps to reproduce

      1. Get a JIRA backup from an instance with at least 20 Issue entities for a single project. e.g. create 10 issues with JIRA Service Desk. Each will add 3 issue entities
        • You can verify that with the following SQL query
          select * from entity_property where entity_name = 'IssueProperty'
      2. Import the project into another JIRA instance already containing data in the entity_property for the same IDs displayed in the query above

      Expected results
      JIRA Should import the project without any problems, using the next ID available for the entity_property table

      Actual results
      JIRA aborts the import as it tries to use the same IDs to add the respective Issue properties to the entity_properties table

      Workaround
      As a workaround you can change the EntityProperty IDs directly in the entities.xml file of the backup.

      1. Find entity IDs to change for the project. Run this at source JIRA Insert your project key into this query:
        SELECT EP.id
        FROM entity_property EP, jiraissue I, project P
        WHERE EP.entity_name = 'IssueProperty' AND I.id = EP.entity_id
          AND P.id = I.project AND P.pkey = 'YOUR_PROJECT_KEY'
        ORDER BY EP.id;
        
      2. Determine the current MAX(id), run this at target JIRA:
        SELECT MAX(id) FROM entity_property
        
      3. Modify the XML backup file, replacing the entity_property IDs with sequential numbers higher than MAX(id) from the entity_property table.
        • Make sure you only modify XML nodes that begin with "<EntityProperty id=". If the entities.xml file is large you may need to use vi or another editor that can handle really big files.
      4. Complete the import
      5. Shut down the target instance
      6. Reset the sequence_value_item table for EntityProperty types, run this at target JIRA:
        UPDATE sequence_value_item SET seq_id = (SELECT MAX(id)+100 FROM entity_property) WHERE seq_name = 'EntityProperty';
        
      7. Restart the target instance

      See KB for more detailed steps and simplified option to modify the XML backup file: Project Import fails due to too many errors

      Attachments

        Issue Links

          Activity

            People

              ajakubowski Adam Jakubowski (Inactive)
              malmeida Marcus Silveira
              Votes:
              53 Vote for this issue
              Watchers:
              56 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: