XML Backup of Crowd database fails with NullPointerException

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Summary

Performing an XML backup of the Crowd instance can fail with a java.lang.NullPointerException error.

Environment

Crowd Server and Data Center

Diagnosis

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.

Cause


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 null.

Solution

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:

(warning) 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.


Last modified on May 20, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.