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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

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.

0 votes
brbojorque Community Leader 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

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.

Also ran into this today as well..

Jira Server v8.5.3

SR: 5.6.14.1-p5

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Jira Cloud Performance Improvements

Hello everyone, I am a product manager in the Jira Cloud team focused on making sure our customers have a delightful experience using our products. Towards that goal, one of the areas which is extr...

171 views 2 9
Read article

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