Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

java.lang.NullPointerException: Cannot invoke method addURL() on null object

Nishant Kansal March 21, 2016

Please help me to resolve this null pointer exception.

I am executing this script from "Script Runner" console in JIRA.

--------------------------------------------------------------------------------------------------------------------------

this.class.classLoader.rootLoader.addURL(new URL("file:///C:/TEMP/sqljdbc4.jar"))

import groovy.sql.Sql
import java.sql.Driver

def sql = Sql.newInstance("jdbc:sqlserver://servername:1433/Valid_DB_Name", "Valid user", "valid password", "com.microsoft.sqlserver.jdbc.SQLServerDriver")
--------------------------------------------------------------------------------------------------------------------------

1 answer

0 votes
Nic Brough -Adaptavist-
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.
March 21, 2016

The first line of your code here calls a method on an object that does not exist at the point at which you run it.  The "this" is empty!

 

Nishant Kansal March 25, 2016

Thanks, Nic.

Could you please help me further to resolve it? I am not much into OO programming and although I understood your point, however, couldn't able to think of the resolution as such.

 

Nic Brough -Adaptavist-
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.
March 25, 2016

I can't tell you anything more - your code and explanation do not explain what the "this" object is for or where you expect it to come from

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events