Unable to import XML backup with the error message "Couldn't replicate the entire batch using the BatchProcessor"
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Problem
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)
Diagnosis
Diagnostic Steps
- 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
Cause
Invalid memberships are caused by a bug in Crowd which does not remove user membership for a deleted user: - CWD-3138Getting issue details... STATUS
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';
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.