XML Backup of Crowd database fails with NullPointerException
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
Performing an XML backup of the Crowd instance can fail with a
Crowd Server and Data Center
Within the application log, check for the following NPE exception:
Stack trace : java.lang.NullPointerException at com.atlassian.crowd.migration.MembershipMapper.addMembershipToXml(MembershipMapper.java:124) at com.atlassian.crowd.migration.MembershipMapper.exportXml(MembershipMapper.java:87) at com.atlassian.crowd.migration.XmlMigrator.exportXml(XmlMigrator.java:36)
If the stack trace for this null pointer exception references the addition of memberships to the XML like the one indicated above, follow the Solution from this article.
This can occur if users or groups were deleted from the Crowd instance in the past but the membership entry did not get deleted from the database. In this case, a child_id or parent_id value in the CWD_MEMBERSHIP table is updated with a
Verify if there's a null value for either of these columns in the CWD_MEMBERSHIP table:
select * from CWD_MEMBERSHIP where child_id = null OR parent_id = null;
If results are returned, delete the problematic entry:
Before proceeding, make sure that you have:
* Shutdown Crowd
* Have the most recent, full backup of your Crowd database
delete from CWD_MEMBERSHIP where child_id = null OR parent_id = null;
Startup Crowd and perform the XML backup again.