It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

InvocationTargetException caused by NPE Edited

Joy Melendez Sep 05, 2018

I am writing a custom JQL scriptrunner function following the instructions here: https://scriptrunner.adaptavist.com/latest/jira/custom-jql-functions.html

I copied the Projects Version example code from the page above and saved it in the JIRA scripts directory. When I click on "scan", I get the error below.  I tried different examples and get the same thing.

Using plugin v. 5.4.12 

 

/rest/scriptrunner-jira/latest/jqlfunctions/scan [c.a.jira.plugin.AbstractJiraModuleDescriptor] Unable to instantiate module class: class com.onresolve.jira.groovy.jql.ScriptedJqlFunction java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor491.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.jira.plugin.AbstractJiraModuleDescriptor$GhettoInitter.maybeInit(AbstractJiraModuleDescriptor.java:297) at com.atlassian.jira.plugin.AbstractJiraModuleDescriptor.createModule(AbstractJiraModuleDescriptor.java:191) at com.atlassian.jira.plugin.AbstractJiraModuleDescriptor$1.create(AbstractJiraModuleDescriptor.java:64) at com.atlassian.util.concurrent.ResettableLazyReference$InternalReference.create(ResettableLazyReference.java:182) at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:325) at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:143) at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112) at com.atlassian.util.concurrent.ResettableLazyReference.get(ResettableLazyReference.java:92) at com.atlassian.jira.plugin.AbstractJiraModuleDescriptor.getModule(AbstractJiraModuleDescriptor.java:175) at com.atlassian.jira.jql.operand.registry.LazyResettableJqlFunctionHandlerRegistry.loadFromJqlFunctionModuleDescriptors(LazyResettableJqlFunctionHandlerRegistry.java:74) at com.atlassian.jira.jql.operand.registry.LazyResettableJqlFunctionHandlerRegistry$1.create(LazyResettableJqlFunctionHandlerRegistry.java:52) at com.atlassian.jira.jql.operand.registry.LazyResettableJqlFunctionHandlerRegistry$1.create(LazyResettableJqlFunctionHandlerRegistry.java:49) at com.atlassian.util.concurrent.ResettableLazyReference$InternalReference.create(ResettableLazyReference.java:182) at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:325) at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:143) at com.atlassian.util.concurrent.LazyReference.get(LazyReference.java:112) at com.atlassian.util.concurrent.ResettableLazyReference.get(ResettableLazyReference.java:92) at com.atlassian.util.concurrent.Supplier$get$0.call(Unknown Source) at com.onresolve.scriptrunner.runner.JqlFunctionsManagerImpl.getScriptedFunctions(JqlFunctionsManagerImpl.groovy:167) at com.onresolve.scriptrunner.runner.rest.jira.JqlFunctionsEndpoint.rescanScriptFunctions(JqlFunctionsEndpoint.groovy:47) ... 3 filtered at java.lang.reflect.Method.invoke(Method.java:498) ... 19 filtered at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:154) ... 1 filtered at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:68) ... 36 filtered at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21) ... 53 filtered at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$2(JiraSecurityFilter.java:78) ... 1 filtered at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:76) ... 16 filtered at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:37) ... 20 filtered at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30) ... 10 filtered at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21) ... 4 filtered at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36) ... 29 filtered at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25) ... 27 filtered at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException: Cannot invoke method toURI() on null object at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:35) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.loadScriptByName(ScriptRunnerImpl.groovy:686) at com.onresolve.scriptrunner.runner.ScriptRunner$loadScriptByName$3.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at com.onresolve.scriptrunner.runner.ScriptRunner$loadScriptByName$3.call(Unknown Source) at com.onresolve.jira.groovy.jql.ScriptedJqlFunction.init(ScriptedJqlFunction.groovy:77)

 

Any idea what is happening?

 

1 answer

1 accepted

0 votes
Answer accepted
Joy Melendez Sep 11, 2018

I knew this was going to be something very simple. The groovy file name needs to be the same name as the class name. Duh!

Krzysztof Czeladko Nov 22, 2018

thank for solution very help-full solved my problem

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Marketplace Apps & Integrations

Demo Den Ep. 4: Continuous Integration with CircleCI & Jira Software

Get ready! Demo Den Episode 4 is coming your way on Tuesday, May 28, 2018 with a Continuous Integration and Delivery special demo. CircleCI Director of Solutions Engineering, Eddie Webb will show us ...

709 views 0 4
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you