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"
You can get the connection through other means, eg https://studio.plugins.atlassian.com/wiki/display/GRV/Miscellaneous+Groovy+Scripts#MiscellaneousGroovyScripts-ExecuteaSQLquery
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you share the script ? what the script does ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.