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 vote

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

0 vote
Mizan Community Champion Oct 18, 2012

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

784 views 2 19
Join discussion

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