Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Reading context param

Greetings:

 

I am trying to read file name as an input from context param and pass it to s3Get to read it from a bucket. I tried using s3List and s3Get to read files and it works fine. But my requirement is to read a file that is given through command line argument. I am getting NullPointer exception when the code is trying to look for the context param in the context. I ran the debugger and found the following code acting weird. I appreciate any help. 

 

if (inContext == null) {
inContext = S3ReadFile.class.getClassLoader()
.getResourceAsStream("config/contexts/" + contextStr + ".properties");
}
if (inContext != null) {
// defaultProps is in order to keep the original context value
if (context != null && context.isEmpty()) {
defaultProps.load(inContext);
context = new ContextProperties(defaultProps);
}

inContext.close();
} else if (!isDefaultContext) {
// print info and job continue to run, for case: context_param is not empty.
System.err.println("Could not find the context " + contextStr);
}

I am using Studio for Data Integration v7.3. Here are my project details. 

0683p000009MA5P.png0683p000009MA9e.png

0683p000009M9uQ.png

Labels (3)
6 Replies
TRF
Champion II
Champion II

How are you passing parameters from the command line? Did you try "–context_param yourParameter=whatYouWant"?
Anonymous
Not applicable
Author

Yes, that is what I tried. I also tried setting up prompt value to test run from the studio. Same error both times. 

TRF
Champion II
Champion II

You have to connect tS3Get to tS3Connection to ensure tS3Get starts after the connection has been established:
tS3Connection--(OnComponentOk)-->tS3Get
Anonymous
Not applicable
Author

S3Get is not using existing connection. I have connection details given
with in S3Get. I don't really need tS3Connection.
TRF
Champion II
Champion II

So what if you really remove tS3Connection?
Anonymous
Not applicable
Author

I just tried that too. Same issue.

Exception in component tS3Get_1 (S3ReadFile)
java.lang.NullPointerException
at westat.s3readfile_0_1.S3ReadFile.tS3Get_1Process(S3ReadFile.java:587)
at westat.s3readfile_0_1.S3ReadFile.runJobInTOS(S3ReadFile.java:7331)
at westat.s3readfile_0_1.S3ReadFile.main(S3ReadFile.java:7175)