Restoring an XML Backup Fails due to Exception is org.xml.sax.SAXParseException

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Restoring or importing an xml backup fails and the user may see the following error:

 

The following or a variation of it appears in the atlassian-jira.log:

[Fatal Error] :164021:3: The element type "CustomFieldValue" must be terminated by the matching end-tag "</CustomFieldValue>".
2013-02-07 13:43:15,954 JiraImportTaskExecutionThread-1 ERROR anonymous 823x14x1 fbaod1 0:0:0:0:0:0:0:1%0 /secure/SetupImport.jspa [jira.bc.dataimport.DefaultDataImportService] Error parsing export file: org.xml.sax.SAXParseException: The element type "CustomFieldValue" must be terminated by the matching end-tag "</CustomFieldValue>".
org.xml.sax.SAXParseException: The element type "CustomFieldValue" must be terminated by the matching end-tag "</CustomFieldValue>".
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at com.atlassian.jira.bc.dataimport.DefaultDataImportService.parseXmlAndValidateBackupData(DefaultDataImportService.java:299)
	at com.atlassian.jira.bc.dataimport.DefaultDataImportService.doImport(DefaultDataImportService.java:229)
	at com.atlassian.jira.web.action.setup.DataImportAsyncCommand.call(DataImportAsyncCommand.java:65)

Cause

JIRA is unable to parse the XML file due to an invalid tag closure.  This causes a premature break in the file and JIRA is unable to complete the operation.

Workaround

Please try running an xml syntax checker of your choice on the entities.xml file from the backup zip.

Ensure that you create a copy of your backup first

For example, running xmllint on the entities.xml file from the failed backup will report an error where an xml is broken.

[~/jira.5.2.5/jira/jirahome/import] xmllint entities.xml
entities.xml:164021: parser error : Opening and ending tag mismatch: CustomFieldValue line 1105 and entity-engine-xml
</entity-engine-xml>
                    ^
entities.xml:164022: parser error : Premature end of data in tag entity-engine-xml line 1013
  • From here, you can correct the broken tag as indicated in the syntax checker. In the above example, it means adding the tag: 
    </entity-engine-xml>
  • or you can simply attempt to export you data once more, and please try importing again.  
Last modified on Nov 2, 2018

Was this helpful?

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