Deploy: SCP Task Error (java.lang.NullPointerException)
Asked by William Raendchen:

Hello,

I'm setting up Bamboo for the first time.

I did a successful build and then wanted to do a deploy, including an **SCP task**.

I get the error message "Error occurred while running Task 'copy files(3)' of type com.atlassian.bamboo.plugins.bamboo-scp-plugin:scptask." (See full log below).  

Currently I have no idea what the issue might be.  
The SSH credentials work as an SSH task in the same job (ls -lsah) completes successfully.  
The task config looks like this:  
![scptask-conf.png](https://community.atlassian.com/t5/image/serverpage/image-id/54003iA72B8226C1DA740D/image-size/large?v=v2&px=999 "scptask-conf.png")  

I installed Bamboo on my Windows 10 machine for testing purposes. I didn't install any extra software so far, outside from Bamboo and adding JAVA_HOME to my PATH to make it run in the first place.  
I'm running start-bamboo.bat in an administrator shell  

**Full Log**

|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| 09-Mai-2019 12:25:58 | Build Deployment of 'release-1' on 'test' started building on agent Default Agent                                                               |
| 09-Mai-2019 12:25:58 |                                                                                                                                                 |
| 09-Mai-2019 12:25:58 | Build working directory is C:\\Users\\Raendchen\\bamboo-home\\xml-data\\build-dir\\1015809-1081345                                              |
| 09-Mai-2019 12:25:58 | Executing build Deployment of 'release-1' on 'test'                                                                                             |
| 09-Mai-2019 12:25:58 | Starting task 'Clean working directory task' of type 'com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:cleanWorkingDirectoryTask' |
| 09-Mai-2019 12:25:58 | Cleaning working directory 'C:\\Users\\Raendchen\\bamboo-home\\xml-data\\build-dir\\1015809-1081345'                                            |
| 09-Mai-2019 12:25:58 | Finished task 'Clean working directory task' with result: Success                                                                               |
| 09-Mai-2019 12:25:58 | Starting task 'Download release contents' of type 'com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:artifactdownloadertask'       |
| 09-Mai-2019 12:25:58 | Finished task 'Download release contents' with result: Success                                                                                  |
| 09-Mai-2019 12:25:58 | Starting task 'ls' of type 'com.atlassian.bamboo.plugins.bamboo-scp-plugin:sshtask'                                                             |
| 09-Mai-2019 12:25:58 | Connecting to \[redacted\] on port: 22                                                                                                          |
| 09-Mai-2019 12:25:58 | Executing \[ls -lsah\]                                                                                                                          |
| 09-Mai-2019 12:25:58 | total 24K                                                                                                                                       |
| 09-Mai-2019 12:25:58 | 4.0K drwxr-xr-x 3 bamboo bamboo 4.0K May 9 12:21 .                                                                                              |
| 09-Mai-2019 12:25:58 | 4.0K drwxr-xr-x 4 root root 4.0K May 9 12:21 ..                                                                                                 |
| 09-Mai-2019 12:25:58 | 4.0K -rw-r--r-- 1 bamboo bamboo 220 May 9 12:21 .bash_logout                                                                                    |
| 09-Mai-2019 12:25:58 | 4.0K -rw-r--r-- 1 bamboo bamboo 3.5K May 9 12:21 .bashrc                                                                                        |
| 09-Mai-2019 12:25:58 | 4.0K -rw-r--r-- 1 bamboo bamboo 675 May 9 12:21 .profile                                                                                        |
| 09-Mai-2019 12:25:58 | 4.0K drwx------ 2 bamboo bamboo 4.0K May 9 12:22 .ssh                                                                                           |
| 09-Mai-2019 12:25:58 | \[ls -lsah\] has finished.                                                                                                                      |
| 09-Mai-2019 12:25:58 | Result: exit code = 0                                                                                                                           |
| 09-Mai-2019 12:25:58 | Finished task 'ls' with result: Success                                                                                                         |
| 09-Mai-2019 12:25:58 | Starting task 'copy files' of type 'com.atlassian.bamboo.plugins.bamboo-scp-plugin:scptask'                                                     |
| 09-Mai-2019 12:25:58 | Error occurred while running Task 'copy files(3)' of type com.atlassian.bamboo.plugins.bamboo-scp-plugin:scptask.                               |
| 09-Mai-2019 12:25:58 | java.lang.NullPointerException                                                                                                                  |
| 09-Mai-2019 12:25:58 | at java.io.File.\<init\>(Unknown Source)                                                                                                        |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.plugins.scp.ScpTask.artifactToScpFromTransferTask(ScpTask.java:198)                                                     |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.plugins.scp.ScpTask.getPathSpecToCopy(ScpTask.java:137)                                                                 |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.plugins.scp.ScpTask.run(ScpTask.java:112)                                                                               |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.plugins.scp.ScpTask.execute(ScpTask.java:107)                                                                           |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$1(TaskExecutorImpl.java:315)                                                  |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:252)                                          |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:315)                                                           |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:112)                                                                |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73)                                                    |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:203)                                          |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:175)                                                      |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:131)                 |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)                          |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:125)                          |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:126)                                                      |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)                                                                    |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)                                                       |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)                                        |
| 09-Mai-2019 12:25:58 | at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)                                                         |
| 09-Mai-2019 12:25:58 | at java.lang.Thread.run(Unknown Source)                                                                                                         |
| 09-Mai-2019 12:25:58 | Finalising the build...                                                                                                                         |
| 09-Mai-2019 12:25:58 | Stopping timer.                                                                                                                                 |
| 09-Mai-2019 12:25:58 | Build 1015809-1081345-1409032 completed.                                                                                                        |
| 09-Mai-2019 12:25:58 | Finished processing deployment result Deployment of 'release-1' on 'test'                                                                       |


Answers:
author: William Raendchen
body: The error cause seemed to be, that no artifact was configured in my **Build** plan -\> Default Job.  
I added an artifact simply with the pattern "\*\*/\*", which clones all files from the working directory, except CVS folders by default.

![2019-05-09 16_08_40-DDash2 - DDash2 - Default Job_ Edit job configuration - Atlassian Bamboo.png](https://community.atlassian.com/t5/image/serverpage/image-id/54019iFD193476F0067C4C/image-size/large?v=v2&px=999 "2019-05-09 16_08_40-DDash2 - DDash2 - Default Job_ Edit job configuration - Atlassian Bamboo.png")  

Afterwards I got another error "Unable to download artifact Shared artifact: ..."  
Browsing the forum for this error, it turned out changing (or adding) artifacts after configuring your deployment job can destroy the job and you just have to reconfigure the whole project from scratch.  

I did that and now everything is working like a charm.  
I hope this info helps some newcomers stumbling on the same problem, and that maybe the error messages / instability when modifying artifact definitions get addressed at some point.  

Cheers, William


Tags: scp