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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,552,028
Community Members
 
Community Events
184
Community Groups

Scriptrunner Listener Issue

Edited

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

0 votes
Answer accepted

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.

Also ran into this today as well..

Jira Server v8.5.3

SR: 5.6.14.1-p5

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.
Feb 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.

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events