The JIRA application statuses page throws a 500 Error
Symptoms
The following page appears when trying access to the Statuses page:
Or you can't see any workflow listed when navigating to workflows page.
With the following Error when expanded:
Technical details
Log's referral number: 0b8255e1-5025-4373-bbbb-744ded4b9177
Cause
Referer URL: http://10.60.5.147:8624/jira624/secure/admin/ViewStatuses.jspa
com.google.template.soy.tofu.SoyTofuException: In template JIRA.Templates.Statuses.success: In 'foreach' command {foreach $status in $statuses}{call .statusRow}{param status: $status /}{/call}{/foreach}, the data reference does not resolve to a SoyListData.
com.google.template.soy.tofu.SoyTofuException: In template JIRA.Templates.Statuses.success: In 'foreach' command {foreach $status in $statuses}{call .statusRow}{param status: $status /}{/call}{/foreach}, the data reference does not resolve to a SoyListData.
at com.google.template.soy.tofu.internal.BaseTofu.renderMainHelper(BaseTofu.java:341)
at com.google.template.soy.tofu.internal.BaseTofu.renderMain(BaseTofu.java:300)
at com.google.template.soy.tofu.internal.BaseTofu.access$100(BaseTofu.java:56)
at com.google.template.soy.tofu.internal.BaseTofu$RendererImpl.render(BaseTofu.java:427)
Diagnosis
Check in the atlassian-jira.log
whether the following error is written:
Caused by: com.atlassian.cache.CacheException: java.lang.IllegalStateException: There are more than one draft workflows associated with the workflow named '<workflow name>'
at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:67)
at com.atlassian.jira.workflow.CachingDraftWorkflowStore.getDraftWorkflow(CachingDraftWorkflowStore.java:55)
at com.atlassian.jira.workflow.OSWorkflowManager.getDraftWorkflow(OSWorkflowManager.java:249)
or
Caused by: com.atlassian.cache.CacheException: java.lang.IllegalStateException: There are more than one workflows associated with '<workflow name>' in the database!
at com.atlassian.cache.memory.DelegatingCache$DelegatingLoadingCache.get(DelegatingCache.java:270)
at com.atlassian.jira.workflow.CachingWorkflowDescriptorStore.getWorkflow(CachingWorkflowDescriptorStore.java:68)
at com.atlassian.jira.workflow.JiraWorkflowFactory.getWorkflow(JiraWorkflowFactory.java:37)
at com.opensymphony.workflow.config.DefaultConfiguration.getWorkflow(DefaultConfiguration.java:89)
or
2016-04-07 15:35:49,564 http-nio-8711-exec-20 ERROR <username> 935x813x1 r6dcz1 172.18.66.246 /secure/admin/workflows/ListWorkflows.jspa [webwork.util.ValueStack] query="inactiveWorkflows" {[id="inactiveWorkflows" type="8" values=""]}
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Cause
1) The JIRA application database has a duplicate record for a draft workflow. The problem is likely to occur when there are multiple Administrators who are creating workflow drafts of the same workflow at roughly the same time.
- JRA-40009Getting issue details... STATUS
1.1) The Jira application has a corrupted draft workflow(only one). We cannot open the original workflow for editing.
2) The JIRA application database has a duplicate record for a workflow.
3) There are orphaned scheme references (e.g. workflow, permission, notification) in the nodeassociation JIRA table referencing a deleted project. This produces a NullPointerException when the workflow list is populated. The following SQL query can be used to diagnose the problem:
select * from nodeassociation where SOURCE_NODE_ENTITY='Project' AND SOURCE_NODE_ID not in (select ID from project);
4) Workflow contains duplicate actions
Resolution 1
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.
Run the following SQL query on the database (to identify the drafts with more than one entry):
SELECT count(*), parentname FROM jiradraftworkflows group by parentname having count(*) > 1;
For the workflows(not draft), run the following query :
SELECT count(*), workflowname FROM jiraworkflows group by workflowname having count(*) > 1;
Delete one of the Id which have the same parentname.
SELECT id, parentname from jiradraftworkflows; DELETE from jiradraftworkflows where id = <chosen_id_with_duplicated_parentname>;
For the workflows(not draft), run the following query :
SELECT id,workflowname FROM jiraworkflows; DELETE from jiraworkflows where id = <chosen_id_with_duplicated_workflowname>;
- Restart JIRA.
- Run a re-index of your instance.
Resolution 1.1
Run the following SQL query on the database (to identify all the draft workflows):
select id,parentname from jiradraftworkflows ;
Try to open each of the workflows for editing and notice if you face any issue while opening any
If you face an error while opening a workflow for editing, you will need to follow these steps:
- Shutdown JIRA (as the draft workflow XML could be cached in memory)
- Run the following SQL:
-- Confirm the draft workflow ID being deleted (should return 1 and only 1 row)
SELECT id, parentname from jiradraftworkflows where id = <workflow_id_with_error>;
-- Run the delete
DELETE from jiradraftworkflows where id = <workflow_id_with_error>;
-- You should get 1 row affected
-- Check that the workflow is now gone (should return 0 rows)
SELECT id, parentname from jiradraftworkflows where id = <workflow_id_with_error>;
-- You may need to run COMMIT if your SQL editor does not do auto-commit
commit;
- Start JIRA and check that you can now click on JIRA Administration » Issues » Statuses without errors
Resolution 2
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.
Run the following SQL query on the JIRA database to identify orphaned schemes associated to a deleted JIRA project. This query should return no results. If you do get any results, you are likely affected by this.
Diagnosis: orphaned rows in the nodeassociation tableselect * from nodeassociation where SOURCE_NODE_ENTITY='Project' AND SOURCE_NODE_ID not in (select ID from project);
Run the following query to delete these orphaned schemes for non-existent projects:
Remove orphaned rows in the nodeassociation tabledelete from nodeassociation where SOURCE_NODE_ENTITY='Project' AND SOURCE_NODE_ID not in (select ID from project);
- Restart JIRA.
- Run a re-index of your instance.
Resolution 3
Remove duplicated action in the workflow. Refer to Fixing Workflows with Duplicate occurance of action
Resolution 4
Incase you are using script-runner plugin then issue can be resolved by executing below code in script runner console: