Error Importing from XML backup: A Group in the backup file is missing the groupName parameter
症状
An error message is returned when trying to import from an XML backup into JIRA, for instance, when performing a Project Import.
The following appears in the atlassian-jira.log
:
2014-04-04 16:20:27,322 JiraTaskExectionThread-4 WARN rkande 937x8062506x2 i207p5 10.27.75.101,10.236.32.25 /secure/admin/ProjectImportSelectProject.jspa [imports.project.handler.ChainedSaxHandler] Encountered a parsing exception.
com.atlassian.jira.exception.ParseException: A Group in the backup file is missing the groupName parameter.
at com.atlassian.jira.imports.project.parser.GroupParserImpl.parse(GroupParserImpl.java:28)
at com.atlassian.jira.imports.project.handler.GroupMapperHandler.handleEntity(GroupMapperHandler.java:45)
診断
Run the following SQL queries against JIRA database. If there are any results returned from the queries, then this KB is applicable:
To check any 'group_name' with NULL value
SELECT * FROM <jira-schema>.cwd_group WHERE group_name IS NULL;
To check any 'group_name' with an empty string value
SELECT * FROM <jira-schema>.cwd_group WHERE group_name = "";
If the above 2 queries return nothing then:
SELECT group_name,lower_group_name FROM <jira-schema>.cwd_group;
Got through the results to check for any 'group_name' with any illegal character/symbol or simply comprising of blank spaces. This could be quite a task for a JIRA instance with lots of groups.
原因
There is a user group in the JIRA instance with no group name or perhaps an invalid group name.
ソリューション
After identifying the problematic records in the cwd_group table from the SQL queries under the Diagnosis section above, a few options are available to fix this (note that you may not be able to delete the group directly in the UI due to JRASERVER-21093 - Group without a group-name cannot be deleted)
- This can be fixed directly from the XML backup.
- Extract the zip file, and edit entities.xml
- Search the entities.xml file for the string '<Group id ="xxx" ', replace xxx with the id of the records without a group name. Alternatively you can search for 'groupName=""' to catch empty groupName
- Manually enter any string such as 'temp-group-name' for groupName and lowerGroupName for this group entries.
- Zip up the XML backup files again
- Attempt to re-import into JIRA.
Alternatively, run SQL updates on the affected groups to set the group_name and lower_group_name attributes directly from the database:
Backup JIRA database
Run the following SQL update statement on the source JIRA instance:
UPDATE cwd_group SET group_name = 'temp-group-name', lower_group_name = 'temp-group-name' WHERE ID = 'xxx';
(replace xxx with corresponding group ID)
Restart JIRA for the changes to take effect. Take a new XML backup from this JIRA instance to try your import again. Also, it should now be possible to delete the problematic groups from JIRA UI if necessary.