Unable to open Import configuration in Insight
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
On certain Object Schemas, clicking on "Import" button inside Schema configuration throws this error:
Something went wrong. Contact administrator
Jira with Insight
In the atlassian-jira.log this NullPointerException will appear:
2021-07-07 13:20:54,475+0200 http-nio-8080-exec-17 url: /rest/insight/1.0/importsource/objectschema/9; user: xxxxxx ERROR xxxxxx 800x13270x1 1jglmb6 10.9.56.9,10.9.8.21 /rest/insight/1.0/importsource/objectschema/9 [c.r.j.p.i.c.w.a.r.exception.mapper.DefaultMapper] Unexpected exception was thrown while processing the request java.lang.NullPointerException at com.riadalabs.jira.plugins.insight.services.validation.ValidateImportSourceImpl.validateImportSourceOT(ValidateImportSourceImpl.java:317) at com.riadalabs.jira.plugins.insight.services.validation.ValidateImportSourceImpl.validateImportSourceOTForExecution(ValidateImportSourceImpl.java:144) at com.riadalabs.jira.plugins.insight.services.core.impl.ImportSourceConfigurationServiceImpl.invalidateImportSourceOTIfInvalid(ImportSourceConfigurationServiceImpl.java:1404) at com.riadalabs.jira.plugins.insight.services.core.impl.ImportSourceConfigurationServiceImpl.updateImportSourceStatus(ImportSourceConfigurationServiceImpl.java:1322) at com.riadalabs.jira.plugins.insight.services.core.impl.ImportSourceConfigurationServiceImpl.findImportSourcesBySchema(ImportSourceConfigurationServiceImpl.java:167) at com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.imports.ImportSourceConfigurationResource.findImportSourceBySchema(ImportSourceConfigurationResource.java:80)
Run this SQL query to find if there are any object type IDs which are there in the import source data but actually doesn't exist anymore:
SELECT * FROM "AO_8542F1_IFJ_IMPORT_SRC_OT" WHERE "OBJECT_TYPE_ID" NOT IN (SELECT "ID" FROM "AO_8542F1_IFJ_OBJ_TYPE");
This query should ideally return no rows. Only continue with the steps in Solution if this query returns results.
This could typically happen if the import configuration refers to an object type id which doesn't exist anymore possibly due to an incomplete delete operation.
Note: Please take a latest backup of your DB before running the following steps to have a safe checkpoint just in case.
If one or more row(s) are returned by the SQL query in the Diagnosis section then it means we have one/more Object type IDs which doesn't actually exist anymore and hence returning the NULL causing the NullPointerException. We'd need to DELETE these entries:
DELETE FROM "AO_8542F1_IFJ_IMPORT_SRC_OT" WHERE "OBJECT_TYPE_ID" NOT IN (SELECT "ID" FROM "AO_8542F1_IFJ_OBJ_TYPE");