[resolved] NullPointerException in tFTPFileProperties

One Star

[resolved] NullPointerException in tFTPFileProperties

I need to copy the most recent file (today's file) off an sftp server. There are also older files out there, so I need to sort through to get only today's file.
I set up tFTPFileList --> tFTPFileProperties (etc.) but at this point, when I run it, I'm getting the following error on tFTPFileProperties:
Exception in component tFTPFileProperties_1
java.lang.NullPointerException
at cdd_test_djr.get_cdd_file_0_1.Get_CDD_file.tFTPFileList_1Process(Get_CDD_file.java:938)
at cdd_test_djr.get_cdd_file_0_1.Get_CDD_file.runJobInTOS(Get_CDD_file.java:1369)
at cdd_test_djr.get_cdd_file_0_1.Get_CDD_file.main(Get_CDD_file.java:1271)
I set up a println (in tJava) coming off of tFTPFileList to see what was coming in, and at that point in the process, the filenames are there. But as soon as it get to tFTPFileProperties, it fails. Below are some screen shots. Any ideas?
It couldn't have anything to do with the connection could it? I didn't see any way to disconnect from the ftp server.
Thanks!
Daphne

Accepted Solutions
Community Manager

Re: [resolved] NullPointerException in tFTPFileProperties

Hello
How do you set the file path of tFileProperties?
In this case, it should be:
((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
One Star

Re: [resolved] NullPointerException in tFTPFileProperties

I thought the FTP was the problem, but I just tried essentially the same thing on a local directory and still got nulls back. I double-checked that there *are* files in the directory I'm checking and I'm not getting an error--just not getting any data.
Community Manager

Re: [resolved] NullPointerException in tFTPFileProperties

Hello
How do you set the file path of tFileProperties?
In this case, it should be:
((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] NullPointerException in tFTPFileProperties

Yes, as Shong said you are using the ((String)globalMap.get("tFTPFileList_1_CURRENT_FILE")) which gives you just the file name. You could either add the directory in front or just simply ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")).
Wiktor
One Star

Re: [resolved] NullPointerException in tFTPFileProperties

Thank you for the advice! That solved the problem with tFileList and tFileProperties. I'm still having a problem with tFTPFileList and tFTPFileProperties, though.
I first set up the job using tFileList and tFileProperties (deactivated in the picture below), and with your help I got that working exactly the way I wanted it. Except, of course, that the files I want to look at are on an FTP server, not a local drive. So I replaced tFileList and tFileProperties with tFTPFileList and tFTPFileProperties, and started getting the null pointer exception error again. Any ideas?
Thanks!
Daphne
Exception in component tFTPFileProperties_1
java.lang.NullPointerException
at cdd_test_djr.get_cdd_file_0_1.Get_CDD_file.tFTPFileList_1Process(Get_CDD_file.java:1615)
at cdd_test_djr.get_cdd_file_0_1.Get_CDD_file.runJobInTOS(Get_CDD_file.java:2198)
at cdd_test_djr.get_cdd_file_0_1.Get_CDD_file.main(Get_CDD_file.java:2073)
Community Manager

Re: [resolved] NullPointerException in tFTPFileProperties

Hello
On tFTPFileProperties, you check 'use the exist connection' option, but there is no a tFTPConnection in your job. That's why you get a nullexception.
I add a new 9055 on tFTPConnection.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] NullPointerException in tFTPFileProperties

Thank you for your help!
Daphne