Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] NullPointerException globalVar

I have a job with two loop and i cannot use a globalVar throught my job, after the first iteration the job failed.
connecting to socket on port 3611
connected
Exception in component tJava_3
java.lang.NullPointerException
at datawarehouse.testerror_0_1.testERROR.tLoop_4Process(testERROR.java:852)
at datawarehouse.testerror_0_1.testERROR.tJava_4Process(testERROR.java:650)
at datawarehouse.testerror_0_1.testERROR.runJobInTOS(testERROR.java:3911)
at datawarehouse.testerror_0_1.testERROR.main(testERROR.java:3758)
disconnected
See print screen for a description
0683p000009ME7H.png
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi
context.getProperty("current_year").equals(
String.valueOf((Integer) globalMap
.get("tLoop_4_CURRENT_VALUE")))

The problem is caused by this code, it returns a null value, modify it to the below code will work, because you use a global var to store the value on tJava_4.
((String)globalMap.get("current_year")).equals(
String.valueOf((Integer) globalMap
.get("tLoop_4_CURRENT_VALUE")))

View solution in original post

4 Replies
Anonymous
Not applicable
Author

Hi
Can you show us the Java code of the tJava_3? it will be helpful for us to locate the problem.
Shong
Anonymous
Not applicable
Author

This is the code
/**
* stop
*/
NB_ITERATE_tJava_3++;
/**
* start
*/
ok_Hash.put("tJava_3", false);
start_Hash.put("tJava_3", System.currentTimeMillis());
currentComponent = "tJava_3";
int tos_count_tJava_3 = 0;
/**
* stop
*/
/**
* start
*/
currentComponent = "tJava_3";
tos_count_tJava_3++;
/**
* stop
*/
/**
* start
*/
currentComponent = "tJava_3";
ok_Hash.put("tJava_3", true);
end_Hash.put("tJava_3", System.currentTimeMillis());
if (!globalMap.get("current_year").equals(
String.valueOf((Integer) globalMap
.get("tLoop_4_CURRENT_VALUE")))) {
tSetGlobalVar_1Process(globalMap);
}
if (context.getProperty("current_year").equals(
String.valueOf((Integer) globalMap
.get("tLoop_4_CURRENT_VALUE")))) {
tRunJob_1Process(globalMap);
}
/**
* stop
*/
Anonymous
Not applicable
Author

Hi
context.getProperty("current_year").equals(
String.valueOf((Integer) globalMap
.get("tLoop_4_CURRENT_VALUE")))

The problem is caused by this code, it returns a null value, modify it to the below code will work, because you use a global var to store the value on tJava_4.
((String)globalMap.get("current_year")).equals(
String.valueOf((Integer) globalMap
.get("tLoop_4_CURRENT_VALUE")))
Anonymous
Not applicable
Author

Thanks that's work now !
Regards