Assets: Using objectschema import to import schema and objects fails with java.lang.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.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

When trying to import an object schema with objects the import will fail to import all objects and display the following error

In the insight_objectschema_import.log you will find the following error

Error
2022-11-25 09:36:29,658 [insight-InsightThreadGroup-worker-thread-5] | Importing object for object type: Host, id 108, and attribute size: 4
2022-11-25 09:36:29,659 [insight-InsightThreadGroup-worker-thread-5] | Error when importing object schema and objects, object schema id: 7
java.lang.NullPointerException
    at java.base/java.util.Objects.requireNonNull(Objects.java:221)
    at java.base/java.util.Arrays$ArrayList.<init>(Arrays.java:4323)
    at java.base/java.util.Arrays.asList(Arrays.java:4310)
    at com.riadalabs.jira.plugins.insight.services.imports.schema.ObjectSchemaImportServiceImpl.importObjects(ObjectSchemaImportServiceImpl.java:1394)

Environment

Jira 8.x or 9.x with Assets plugin installed.

Diagnosis

The file containing the object schema and objects has been created on a Jira instance with the Assets plugin version 8.10.4 or later from our marketplace
or using Jira Service Management 5.0 and later

Cause

The import file is a Zip file, that consists out of the object schema and for each object type, there is a csv file containing the information for all the objects of this object type. During the objectschema export the csv files should be populated with the data about the attributes to be imported. For any object type without objects the export failed to produce a correct file, but produces an empty file instead. This leads to an error during import.

The objectschema export issue is tracked on  JSDSERVER-12193 - Getting issue details... STATUS

Solution

You can fix the import by removing the offending empty files from the zip file. To do this use the following steps:

  • Unzip the exported objectschema file
  • remove all csv files that are empty (zero byte size)
  • zip the remaining files again
  • use the newly created zip file for the import


Last modified on Jan 5, 2024

Was this helpful?

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