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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

184 views 1 11
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