Tech Tips: Getting a java.lang.NullPointerException with FTP Step

Document created by MarcyNunns Employee on Aug 14, 2017
Version 1Show Document
  • View in full screen mode

Issue
I am trying to Upload/Download a txt file from FTP server on Linux using a DevTest FTP Step. When I execute the step, I am getting a java.lang.NullPointerException (NPE).

============================================================================
| Exception:
============================================================================
| Step: FTP
----------------------------------------------------------------------------
| Message: java.lang.NullPointerException
----------------------------------------------------------------------------
| Trapped Exception: null
| Trapped Message: java.lang.NullPointerException
----------------------------------------------------------------------------
STACK TRACE
java.lang.NullPointerException
at com.amoebacode.ftp.FTPUtil.isFTPResponse(FTPUtil.java:146)
at com.amoebacode.ftp.FTPSocket.getServerResponse(FTPSocket.java:157)
at com.amoebacode.ftp.FTPSocket.openConnection(FTPSocket.java:107)
at com.amoebacode.ftp.FTPClient.openConnection(FTPClient.java:135)

 

Environment
DevTest 10.1.0, but should work for all releases that have the FTP Step.

 

Cause

The FTP step lets you send or receive a file using the FTP protocol. After entering the FTP information, user name, and user password, you can either upload a file or download a file.


You can get this type of errors if 1) the FTP Server is not running on the Host machine or 2) the user you are using to access the Host does not have the right permissions.


In this example it was a permissions issue on the FTP Server.

Resolution

In the below example my Host Linux machine 10.130.219.147. My User is test. The file I am wanting to get is also called test and happens to be in my /home/test folder.

 

From a command prompt from the client machine:

C:\Users\nunma04>ftp 10.130.219.147
Connected to 10.130.219.147.
220 (vsFTPd 3.0.2)
User (10.130.219.147:(none)): test
331 Please specify the password.
Password:
230 Login successful.
ftp> get test
200 PORT command successful. Consider using PASV.
150 Opening ASCII mode data connection for test (12 bytes).
226 Transfer complete.
ftp: 14 bytes received in 0.00Seconds 14000.00Kbytes/sec.
ftp>

The contents of my file:
C:\Users\nunma04>type test
testing
123

I know my FTP Server is up and I can login to get my file.

@
This is my FTP Step: FTP normally runs or Port 20 or 21. When I click the Execute Now push button I see the contents of the file are am doing the FTP on.

 

FTP Step

1 person found this helpful

Attachments

    Outcomes