Getting a java.lang.NullPointerException Error with DevTest FTP Step
search cancel

Getting a java.lang.NullPointerException Error with DevTest FTP Step

book

Article ID: 7774

calendar_today

Updated On:

Products

CA Application Test CA Continuous Application Insight (PathFinder) Service Virtualization

Issue/Introduction

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

All supported DevTest releases and platforms.

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 of Host Linux machine <IPAddress>.  The User is test.  The file wanting to get is also called test and happens to be in the /home/test folder of the machine FTPing to..

 

From a command prompt from the client machine:

 

C:\Users\username>ftp {{IP address}}

Connected to {{IP Address}}

220 (vsFTPd 3.0.2)

User ({{IP Address}}:(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 the file:

C:\Users\username>type test

testing

123

 

The FTP Server is up and can login to get the 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.

 

Open up permissions on FTP server.