Unable to run groovy script in JIRA 5.1

I am using a grrovy script for workflow transition. On the transition, it is showing following excepton/error in the log file:


The script failed : javax.script.ScriptException: javax.script.ScriptException: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context"

4 answers

0 votes

You've got an invalid call to the database stuff in your script. You'll need to give us more information - the section of script causing the problem would be a start.

def getSQL = {
Context initialContext = new InitialContext();
if ( initialContext == null) {
log("JNDI problem. Cannot get InitialContext.");
System.exit(0)
}

DataSource datasource = (DataSource)initialContext.lookup("java:comp/env/jdbc/defaultDS");

if (datasource == null) {
log("Failed to lookup datasource.")
System.exit(0)
}

new Sql(datasource)
}

*Note: defaultDS is the datasource name.

Regards

Swati

can you share the script ? what the script does ?

def getSQL = {
Context initialContext = new InitialContext();
if ( initialContext == null) {
log("JNDI problem. Cannot get InitialContext.");
System.exit(0)
}

DataSource datasource = (DataSource)initialContext.lookup("java:comp/env/jdbc/defaultDS");

if (datasource == null) {
log("Failed to lookup datasource.")
System.exit(0)
}

new Sql(datasource)
}

*Note: defaultDS is the datasource name.

Regards

Swati

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,436 views 15 19
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you