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 Wednesday in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

228 views 0 6
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