Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Scriptrunner Listener Issue

Jason MacDonald February 28, 2020

We have a simple groovy script in our Listeners list that *was* working up until recently. Not sure if anything changed on the Jira server (still looking/working with admins), but we now get this error:

groovy.lang.MissingMethodException: No signature of method: UpdateField.main() is applicable for argument types: ([Ljava.lang.String;) values: [[]]
Possible solutions: wait(), wait(long), any(), find(), wait(long, int), init(java.util.Map)
	at com.onresolve.scriptrunner.runner.RunScriptInvoker$run.call(Unknown Source)
	at com.onresolve.scriptrunner.runner.AbstractScriptRunner.runScript(AbstractScriptRunner.groovy:170)
	at com.onresolve.scriptrunner.runner.AbstractScriptRunner$runScript$6.callCurrent(Unknown Source)

 The script:

import com.atlassian.jira.event.issue.AbstractIssueEventListener
import org.apache.log4j.Logger
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.issue.Issue

class UpdateField extends AbstractIssueEventListener {
Logger log = Logger.getLogger(UpdateField.class)
'@Overrde
void workflowEvent(IssueEvent event) {
log.setLevel(org.apache.log4j.Level.DEBUG)

Issue issue = event.issue
def key = issue.getKey()
def cmd = ["/bin/script.bash", key]
cmd.execute()
}
}

 

The groovy script is being called in the Listener list as

/opt/atlassian/jira/atlassian-jira/WEB-INF/classes/com/test/updateIssue.groovy

 

We're using Jira Server v8.1.0 and ScriptRunner v5.6.15.1-p5.

The ScriptRunner docs say the Heritage Custom Listeners are still valid, so not sure what's going on.

Any ideas? Thanks!

4 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Jason MacDonald March 4, 2020

I converted the class to a goovy script and it seems to be working now:

import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.issue.Issue

Issue issue = event.issue
def key = issue.getKey()
def cmd = ["/bin/script.bash", key]
cmd.execute()

I then used the full path to the groovy script in the FILE tab. 

While it was still a class, I had to package it up, then add <package>.class in the SCRIPT tab, however, the external script never got executed. Not sure if workflowEvent needed to be main or not.

0 votes
Brian Rosenauer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 15, 2020

Also ran into this today as well..

Jira Server v8.5.3

SR: 5.6.14.1-p5

0 votes
Jason MacDonald March 3, 2020

Apparently, there's a workaround from Adaptavist, but I haven't been able to get it working yet.

Replacing the path with the corresponding FCQN in the listener config will resolve this.

It's not clear to me where I should put the FQCN; I've tried the file path and script entries, but have been unsuccessful so far.

0 votes
brbojorque
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 28, 2020

Hi @Jason MacDonald ,

What is this groovy script supposed to do? 

I can see that there is a bash script that will be executed in the server what does it do?

Any background on the requirements? I can possibly suggest alternatives but I just don't understand the use case.

Jason MacDonald March 2, 2020

Hi @brbojorque ,

It just calls that bash script to do some restapi calls on another (non-Atlassian) tool. Definitely a hack to accomplish calling that pre-existing script. The bash script gets the issue key as its only argument, and the script does the rest from there.

Thanks!

-Jason

TAGS
AUG Leaders

Atlassian Community Events