JIRA Functionality Fails due to The Project argument and its backing generic value must not be null Error
Symptoms
- When Upgrading JIRA, restoring the XML backup displays the below error.
- Accessing permissions displays the below error.
java.lang.IllegalArgumentException: The Project argument and its backing generic value must not be null
at com.atlassian.jira.security.AbstractPermissionManager.hasPermission(AbstractPermissionManager.java:171)
at com.atlassian.jira.security.AbstractPermissionManager.hasPermission(AbstractPermissionManager.java:159)
at sun.reflect.GeneratedMethodAccessor219.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Cause
There are project versions that refer to non-existent projects in the database. If restoring an XML backup, this will contain those improper values.
Resolution
Always back up your data before performing any modification to the database. If possible, try your modifications on a test server.
The issue can be rectified by removing the bad version entries in the database, by running the queries below in the database:
reFind project versions that is referring to non-existent projects:
SELECT * FROM projectversion WHERE project NOT IN (SELECT id FROM project);
Make sure that no issues are referencing to the bad version entries:
SELECT p.pkey, i.issuenum, a.* FROM jiraissue i JOIN nodeassociation a ON i.id = a.source_node_id JOIN project p ON i.project = p.id WHERE a.association_type IN ( 'IssueVersion', 'IssueFixVersion' ) AND a.sink_node_id IN ( SELECT id FROM projectversion WHERE project NOT IN (SELECT id FROM project) );
Remove the bad entry from the database:
DELETE FROM projectversion WHERE project NOT IN (SELECT id FROM project);
If the above does not solve the problem, please see JIRA: System Error When Project Administrator Trying to Access the Permission Page for further information as it may be related.