Below are the first few lines of my groovy file. When i try to run it from the server, i get the error java.lang.NullPointerException: Cannot invoke method addURL() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)
I am not sure how the code needs to be changed here to fix the above error:
package groovy;
def localFile = new File("/tmp/sqljdbc4.jar");
this.class.classLoader.rootLoader.addURL(localFile.toURI().toURL());
import java.sql.Connection;
import java.sql.DriverManager;
import com.microsoft.sqlserver.jdbc.*;
import groovy.sql.Sql;
Connection ret = null;
try {
SQLServerDataSource ds = new SQLServerDataSource()
......
Thanks
Pria