JCMA Project Migration: Handling NullPointerException

Still need help?

The Atlassian Community is here for you.

Ask the community

Summary

The following article assists in identifying the NullPointerException error during project migration and provides guidance for resolving the issue.

Overview

When the project is migrated from the server to the cloud using JCMA, it encounters an error NullPointerException: No message. The following error is logged in the migration error logs:

ERROR <project_key> project-import We couldn't import Permission Scheme '<Permission_Scheme_name>'. Reason: NullPointerException: No message.

And, below error is logged in the cloud logs:

stack: java.lang.NullPointerException
	at com.atlassian.jira.notification.type.ProjectRoleSecurityAndNotificationType.getArgumentDisplay(ProjectRoleSecurityAndNotificationType.java:181)
	at com.atlassian.jira.permission.management.ManagedPermissionSchemeHelperImpl.getParameterDisplayValue(ManagedPermissionSchemeHelperImpl.java:394)
	at com.atlassian.jira.permission.management.ManagedPermissionSchemeHelperImpl.buildGrants(ManagedPermissionSchemeHelperImpl.java:365)
	at com.atlassian.jira.permission.management.ManagedPermissionSchemeHelperImpl.lambda$generatePermissionSchemeBean$3(ManagedPermissionSchemeHelperImpl.java:263)
	at com.google.common.collect.Iterators$6.transform(Iterators.java:829)
	at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:52)
	at com.google.common.collect.Iterators.addAll(Iterators.java:367)
	at com.google.common.collect.Lists.newArrayList(Lists.java:146)
	at com.google.common.collect.Lists.newArrayList(Lists.java:132)
	at com.atlassian.jira.permission.management.ManagedPermissionSchemeHelperImpl.generatePermissionSchemeBean(ManagedPermissionSchemeHelperImpl.java:278)
	at com.atlassian.jira.permission.management.ManagedPermissionSchemeHelperImpl.getManagedPermissionScheme(ManagedPermissionSchemeHelperImpl.java:122)
	at com.atlassian.jira.permission.management.ManagedPermissionSchemeHelperImpl.addManagedPermissionSchemeGrants(ManagedPermissionSchemeHelperImpl.java:205)

The error indicates that the permission builder is failing due to an invalid argument. This situation can occur when the permission scheme refers to a stale project role, which could mean a configuration without an ID or a role with an ID but no corresponding display name.

Fix NullPointerException error

  1. Run the following query to verify if the configuration without an ID or name is linked in the permission scheme. If the query yields empty IDs, proceed to step 3. Otherwise, proceed with step 2

    select distinct perm_parameter
         , perm_type 
      from schemepermissions 
      where scheme = (select id 
                        from permissionscheme 
                        where name = 'replace_permission_scheme name');
  2. Once the IDs have been obtained, execute the following SQL queries to ensure that the roles utilized in permission schemes possess valid names. 

    select * 
      from projectrole 
     where id in (<IDs>) --replace the IDs obtained from above sql query
  3. Alternatively, execute the following SQL query to identify all roles associated with the permission scheme, and then locate the role without an ID.  

    select project.id
         , project.pkey
         , ps.name
         , sp.* 
      from project 
      join nodeassociation   na on na.source_node_id = project.id 
      join permissionscheme  ps on   na.sink_node_id = ps.id 
      join schemepermissions sp on         sp.scheme = ps.id 
     where association_type = 'ProjectScheme' 
       and sink_node_entity = 'PermissionScheme' 
       and project.pkey = '<pkey>'; --replace the project key obtained from above sql query
  4. Once the configuration has been located, proceed to the permission scheme in the UI and remove the roles identified during the above process.


Last modified on Mar 25, 2024

Was this helpful?

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