Importing from Bugzilla Causes a NullPointerException

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

  1. Importing using the JIRA Importer Plugin causes a NullPointerException, as in the below Stack Trace.

The following appears in the atlassian-jira.log:

2012-04-04 11:56:14,960 http-8080-1 ERROR administrator 716x187x1 admin 10.40.3.145 /secure/admin/views/ImporterValueMappingsPage!default.jspa [com.atlassian.velocity.DefaultVelocityManager] MethodInvocationException occurred getting message body from Velocity: java.lang.NullPointerException
java.lang.NullPointerException
	at com.atlassian.jira.plugins.importer.imports.AbstractStatusValueMapper.getTargetValues(AbstractStatusValueMapper.java:49)
	at com.atlassian.jira.plugins.importer.imports.config.ValueMappingHelperImpl.getTargetValues(ValueMappingHelperImpl.java:161)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:234)
	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:203)
	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
	at org.apache.velocity.runtime.parser.node.ASTReference.evaluate(ASTReference.java:307)
	at org.apache.velocity.runtime.parser.node.ASTExpression.evaluate(ASTExpression.java:45)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:68)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
	at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
	at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:70)
	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
	at org.apache.velocity.Template.merge(Template.java:256)
	at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:422)
	at com.atlassian.velocity.DefaultVelocityManager.getEncodedBody(DefaultVelocityManager.java:77)
	at com.atlassian.jira.plugin.webwork.JiraPluginWebworkVelocityServlet.service(JiraPluginWebworkVelocityServlet.java:57)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)
	at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter$1.doFilter(DelegatingPluginFilter.java:66)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25)
	at com.atlassian.plugin.servlet.filter.DelegatingPluginFilter.doFilter(DelegatingPluginFilter.java:74)
	at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:42)
	at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)
	at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.atlassian.jira.web.filters.accesslog.AccessLogFilter.doFilter(AccessLogFilter.java:77)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)
	at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:77)
	at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:63)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	...

Cause

This particular case has two known causes:

  1. One or more Versions are pointing to one or more Projects that no longer exist.
  2. One or more Statuses are used by a Workflow and no longer exist.

Resolution

Verify if there are missing Versions with Projects attached to them with the below SQL:

SELECT 		pv.id
FROM 		projectversion pv
LEFT JOIN 	project p
ON			pv.project 	= 	p.id
WHERE 		p.id 		IS 	null

If rows are returned from the above SQL, follow these instructions to remove them:

  1. Back up JIRA.
  2. Shut down JIRA.
  3. Run the below SQL.
  4. Restart JIRA and test to ensure the exception is not presented.

 

DELETE FROM projectversion 
WHERE id IN 
	(SELECT 	pv.id
	FROM 		projectversion pv 
	LEFT JOIN 	project p 
	ON 			pv.project 	= 	p.id 
	WHERE 		p.id 		IS 	null)

(info) The provided SQL examples above are PostgreSQL and the syntax may need to be modified depending on your JIRA database.

If the above does not fix the problem, check if any Statuses are missing:

  1. Enter the Workflow Designer for the JIRA issue(s) that are experiencing problems.
  2. Confirm that that the statuses listed in the workflow are loaded in JIRA.
  3. If any are missing, add them in manually.
  4. Test and see if the problem is fixed.

 

 

 

 

 

 

 

Last modified on Mar 30, 2016

Was this helpful?

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