Unable to run groovy script in JIRA 5.1

swati sneha October 18, 2012

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
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2012
0 votes
swati sneha October 21, 2012

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 votes
Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 18, 2012

can you share the script ? what the script does ?

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 18, 2012

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.

swati sneha October 24, 2012

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