Bamboo Data Center import is failing with an error Unexpected exception while importing Artifact Subscriptions

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Bamboo application supports importing data from Bamboo export backup. While importing the ArtifactSubscriptions it could fail with the below error. This article talks about what could be done to resolve this.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Import failed. Please contact Atlassian at https://support.atlassian.com/ and attach your export file. <br /> java.lang.RuntimeException: Unexpected exception ... Output Omitted ... Caused by: com.atlassian.bamboo.migration.exception.BambooImportException: Exception was caught during import in mapper com.atlassian.bamboo.migration.stream.ArtifactSubscriptionMapper@359dab61 at com.atlassian.bamboo.migration.BambooStAXListImportStrategy.importListXml(BambooStAXListImportStrategy.java:224) at com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl.importListXml(BambooStAXMappingListHelperAbstractImpl.java:190) at com.atlassian.bamboo.migration.BambooStAXMappingListHelperAbstractImpl.importListXml(BambooStAXMappingListHelperAbstractImpl.java:176) at com.atlassian.bamboo.migration.stream.ArtifactSubscriptionMapper.importData(ArtifactSubscriptionMapper.java:124) at com.atlassian.bamboo.migration.XmlMigrator.importData(XmlMigrator.java:475) at com.atlassian.bamboo.migration.XmlMigrator.importFromFile(XmlMigrator.java:449) at com.atlassian.bamboo.migration.XmlMigrator.importXmlData(XmlMigrator.java:409) at com.atlassian.bamboo.migration.XmlMigrator.lambda$loadXmlData$5(XmlMigrator.java:379) ... 184 more Caused by: org.hibernate.NonUniqueObjectException: A different object with the same identifier value was already associated with the session : [com.atlassian.bamboo.plan.artifact.ArtifactSubscriptionImpl#98566150] at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:179) at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:134) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:194) at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:38) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:179) at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:32) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:75) at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:107) at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:672) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:665) at org.hibernate.internal.SessionImpl.save(SessionImpl.java:660) at com.atlassian.bamboo.persistence3.HibernateDaoUtils.save(HibernateDaoUtils.java:170) at com.atlassian.bamboo.migration.BambooStAXMappingHelperAbstractImpl.saveBambooObject(BambooStAXMappingHelperAbstractImpl.java:194) at com.atlassian.bamboo.migration.stream.ArtifactSubscriptionMapper.afterImportListItem(ArtifactSubscriptionMapper.java:113) at com.atlassian.bamboo.migration.stream.ArtifactSubscriptionMapper.afterImportListItem(ArtifactSubscriptionMapper.java:31) at com.atlassian.bamboo.migration.BambooStAXListImportStrategy.importListItemXml(BambooStAXListImportStrategy.java:248) at com.atlassian.bamboo.migration.BambooStAXListImportStrategy$3$1.doInTransaction(BambooStAXListImportStrategy.java:99) at com.atlassian.bamboo.migration.BambooStAXListImportStrategy$3$1.doInTransaction(BambooStAXListImportStrategy.java:91) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) at com.atlassian.bamboo.migration.BambooStAXListImportStrategy$3.importListItems(BambooStAXListImportStrategy.java:91) at com.atlassian.bamboo.migration.BambooStAXListImportStrategy.importListXml(BambooStAXListImportStrategy.java:218) ... 191 more

Environment

The issue was observed on Bamboo 9.4.2 running on a Docker container but other versions may be affected.

Diagnosis

When checking the atlassian-bamboo.log the following error appeared when reading the artifactSubscriptions.xml file

1 2 3 4 2024-11-15 05:34:53,724 INFO [http-nio-8085-exec-11] [XmlMigrator] Reading file: /var/atlassian/application-data/bamboo/shared/export_atlassianbamboo_90413_20241115.zip/db-export/artifactSubscriptions.xml 2024-11-15 05:34:53,729 WARN [http-nio-8085-exec-11] [BambooStAXMappingHelperAbstractImpl] Exception during processing artifactSubscriptions.subscription #12 org.hibernate.NonUniqueObjectException: A different object with the same identifier value was already associated with the session : [com.atlassian.bamboo.plan.artifact.ArtifactSubscriptionImpl#98566150] at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:179) ~[hibernate-core-5.6.15.Final-atlassian-2.jar:5.6.15.Final-atlassian-2]

When checking the artifactSubscriptions.xml file in the exported zip file the duplicate IDs were found for different consumerJob in subscription

1 2 3 4 5 6 7 8 9 10 11 <subscription> <id>102793222</id> <definition>102760453</definition> <consumerJob>PROJ-JOB2-RS</consumerJob> </subscription> <subscription> <id>102793222</id> <definition>102760453</definition> <consumerJob>PROJ-JOB2-RS</consumerJob> </subscription> <subscription>

Cause

Duplicate subscription IDs in the artifactSubscriptions.xml export file is causing the import to fail.

Solution

You can manually remove the duplicates from the reported file and run the import again using the following documentation

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.