Unable to import XML backup with the error message "Couldn't replicate the entire batch using the BatchProcessor"
This article only applies to the Atlassian server platform. Learn more about the differences between cloud and server.
Importing a manual or automated XML backup to another Crowd instance failed with the error message: "Couldn't replicate the entire batch using the BatchProcessor"
The following appears in the atlassian-crowd.log
2015-06-03 18:06:09,370 http-bio-8095-exec-11 ERROR [atlassian.crowd.migration.MembershipMapper] Couldn't add com .atlassian.crowd.model.user.InternalUser@731b3bc9 [id=13306451,name=U_060MX, with reatedDate=Wed Jun 03 18:05:56 YEKT 2015, updatedDate=Wed Jun 03 18:05:56 YEKT 2015, active=true, emailAddress = <null>, firstName = <null>, lastName = <null>, displayName = <null>, credential=com.atlassian.crowd.embedded.api.PasswordCredential@aa29210 [credential=X, encryptedCredential=true], lowerName=u_060mx, lowerEmailAddress = <null>, lowerFirstName = <null>, lowerLastName = <null>, lowerDisplayName = <null>, directoryId=10682370, externalId = <null>] 2015-06-03 18:06:09,370 http-bio-8095-exec-11 ERROR [console.action.setup.Import] of Error importing XML data org.hibernate.HibernateException: Couldn't replicate the entire batch using the BatchProcessor. at com.atlassian.crowd.migration.GenericMapper.addEntities (GenericMapper.java:155) at com.atlassian.crowd.migration.MembershipMapper.importXml (MembershipMapper.java:173) at com.atlassian.crowd.migration.XmlMigrator.importXml (XmlMigrator.java:50) at com.atlassian.crowd.migration.XmlMigrationManagerImpl.importXml (XmlMigrationManagerI mpl.java:200)
- Check if there are invalid memberships in your database,
Run the following SQL query, to see if you are affected:
SELECT * FROM cwd_membership WHERE child_id NOT IN (SELECT DISTINCT(ID) FROM cwd_user) AND MEMBERSHIP_TYPE = 'GROUP_USER';
If the SQL query returns with some value, proceed with the workaround
Run the following SQL query in the database in order to remove all invalid, dangling memberships, for users that no longer exists:
DELETE FROM cwd_membership WHERE child_id NOT IN (SELECT DISTINCT(ID) FROM cwd_user) AND MEMBERSHIP_TYPE = 'GROUP_USER';
Alwaysyour data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.