Project import fails with NumberFormatException in Jira server

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

When importing a JIRA Software project, the import fails and the following error is displayed in the logs (atlassian-jira.log):

2016-04-01 01:47:03,483 JiraTaskExectionThread-6 ERROR username 103x3090x1 13tcomw 195.xxx.xxx.xxx,127.0.0.1 /secure/admin/ProjectImportSummary.jspa [c.a.j.imports.xml.DefaultBackupXmlParser] Unexpected import failure
java.lang.NumberFormatException: null
at java.lang.Long.parseLong(Unknown Source)
at java.lang.Long.valueOf(Unknown Source)
at com.atlassian.greenhopper.imports.SprintImportHandler.endTable(SprintImportHandler.java:105)
at com.atlassian.jira.imports.project.ao.handler.ChainedAoSaxHandler.endTable(ChainedAoSaxHandler.java:260)
at com.atlassian.jira.imports.project.ao.handler.ChainedAoSaxHandler.endElement(ChainedAoSaxHandler.java:187)
at com.atlassian.jira.imports.project.ao.handler.ChainedAoSaxHandler.endElement(ChainedAoSaxHandler.java:148)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.atlassian.security.xml.RestrictedXMLReader.parse(RestrictedXMLReader.java:103)
at com.atlassian.jira.imports.xml.DefaultBackupXmlParser$XmlParser.parseXml(DefaultBackupXmlParser.java:115)
at com.atlassian.jira.imports.xml.DefaultBackupXmlParser.parse(DefaultBackupXmlParser.java:64)
at com.atlassian.jira.imports.xml.DefaultBackupXmlParser.parseXml(DefaultBackupXmlParser.java:52)
at com.atlassian.jira.imports.xml.DefaultBackupXmlParser.parseAoBackupXml(DefaultBackupXmlParser.java:46)
at com.atlassian.jira.imports.project.DefaultProjectImportManager.importAoData(DefaultProjectImportManager.java:708)
at com.atlassian.jira.imports.project.DefaultProjectImportManager.doImport(DefaultProjectImportManager.java:656)
at com.atlassian.jira.bc.imports.project.DefaultProjectImportService.doImport(DefaultProjectImportService.java:416)
at com.atlassian.jira.web.action.admin.importer.project.ProjectImportSummary$ProjectImportCallable.call(ProjectImportSummary.java:285)
at com.atlassian.jira.web.action.admin.importer.project.ProjectImportSummary$ProjectImportCallable.call(ProjectImportSummary.java:236)
at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:453)
(...)

Cause

There are issues in the imported project which are included in Sprints that do not exist in the database anymore (in the AO_60DB71_SPRINT table).

JSWSERVER-16064 - Getting issue details... STATUS

Investigation

Run the following queries in the source instance's database (the JIRA Software instance where the XML Backup was taken) to find the affected field:

(info) The queries below were tested for PostgreSQL and MySQL, you would need to find the corresponding query for your database type

Query 1 (PostgreSQL and MySQL)
-- Find the Sprint Custom Field ID
SELECT ID FROM customfield
WHERE customfieldtypekey LIKE '%com.pyxis.greenhopper.jira:gh-sprint%';
Query 2 (PostgreSQL)
-- List all references to the nonexistent Sprints
SELECT * FROM customfieldvalue 
WHERE customfield = <SPRINT_ID_FROM_PREVIOUS_QUERY> 
	AND CAST(stringvalue as int) NOT IN (SELECT "ID" FROM "AO_60DB71_SPRINT");
Query 2 (MySQL)
-- List all references to the nonexistent Sprints
SELECT * FROM customfieldvalue 
WHERE customfield = <SPRINT_ID_FROM_PREVIOUS_QUERY> 
	AND stringvalue NOT IN (SELECT ID FROM AO_60DB71_SPRINT);

 

 

Resolution

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.

  1. Stop your JIRA Software source instance.
  2. Run the SQL query below in the database to delete the invalid Sprint references:

    Query 3 (PostgreSQL)
    -- The <Custom_Field_ID> must be replaced with the Sprint Custom Field ID, found in the Query 1 in the Investigation section.
    DELETE FROM customfieldvalue 
    WHERE customfield = <Custom_Field_ID> 
        AND CAST(stringvalue AS int) NOT IN (SELECT "ID" FROM "AO_60DB71_SPRINT");
    Query 3 (MySQL)
    -- The <Custom_Field_ID> must be replaced with the Sprint Custom Field ID, found in the Query 1 in the Investigation section.
    DELETE FROM customfieldvalue 
    WHERE customfield = <Custom_Field_ID> 
    	AND stringvalue NOT IN (SELECT ID FROM AO_60DB71_SPRINT);

     

     

  3. Start your JIRA Software source instance.
  4. Generate a new XML Backup from the source instance and perform the Project Import in the target instance again.

 

Last modified on Sep 25, 2019

Was this helpful?

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