NullPointerException after importing workflow XML
Symptoms
After importing a workflow XML into JIRA, it is associated with a project. However, the workflow is not working and trying to change the workflow scheme will have the following error:
2012-01-13 13:25:08,876 http-8080-1 WARN admin 805x4665x1 1x445vs 10.49.228.67 /plugins/servlet/project-config/CMS/workflows [plugin.web.model.ResourceTemplateWebPanel] Error rendering WebPanel (workflows/workflows.vm): org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getHtml' in class com.atlassian.jira.web.component.IssueConstantWebComponent threw exception java.lang.NullPointerException at workflows/workflows.vm[line 136, column 65]
com.atlassian.templaterenderer.RenderingException: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getHtml' in class com.atlassian.jira.web.component.IssueConstantWebComponent threw exception java.lang.NullPointerException at workflows/workflows.vm[line 136, column 65]
at com.atlassian.templaterenderer.velocity.one.six.internal.VelocityTemplateRendererImpl.render(VelocityTemplateRendererImpl.java:100)
at com.atlassian.templaterenderer.AbstractVelocityWebPanelRenderer.render(AbstractVelocityWebPanelRenderer.java:33)
at com.atlassian.plugin.web.model.ResourceTemplateWebPanel.getHtml(ResourceTemplateWebPanel.java:47)
at com.atlassian.plugin.web.descriptors.DefaultWebPanelModuleDescriptor$ContextAwareWebPanel.getHtml(DefaultWebPanelModuleDescriptor.java:141)
at com.atlassian.jira.projectconfig.tab.WebPanelTab.getTab(WebPanelTab.java:75)
at com.atlassian.jira.projectconfig.servlet.PanelServlet.outputTab(PanelServlet.java:163)
at com.atlassian.jira.projectconfig.servlet.PanelServlet.doGet(PanelServlet.java:136)
...
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getHtml' in class com.atlassian.jira.web.component.IssueConstantWebComponent threw exception java.lang.NullPointerException at workflows/workflows.vm[line 136, column 65]
...
Caused by: java.lang.NullPointerException
Possible Causes
<meta name="jira.status.id">10004</meta>
<step id="3" name="Blocked">
<meta name="jira.status.id">10004</meta>
Resolution
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.
Possibility 1: The workflow XML is not modified to match the Status ID in Jira
- Shutdown JIRA.
Check the available Status ID in JIRA database:
SELECT * FROM issuestatus;
Find the affected workflow in JIRA database:
SELECT * FROM jiraworkflows;
The imported workflow is stored in the column 'DESCRIPTOR' of the table 'jiraworkflows' in XML format
- Search for the problematic Status ID from the table 'jiraworkflows' and modify it to match the result from STEP 3.
- Restart JIRA.
Possibility 2: An issue status described in the workflow XML does not exist in the issuestatus table in the database.
- Shutdown JIRA.
Check all available issuestatuses in JIRA database:
SELECT * FROM issuestatus;
Insert the needed issue status:
INSERT INTO issuestatus (ID, SEQUENCE, pname, DESCRIPTION, ICONURL) VALUES("1004", "<check available sequences in issuestatus table and add 1>", "Blocked", "This issue is blocked by a blocking issue", "/images/icons/status_closed.gif");
- Restart JIRA.