Bamboo SCP task fails with "java.lang.NullPointerException" error when uploading a shared artifact

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

    

要約

When using the Bamboo SCP task to upload a shared artifact from Bamboo directly to a remote server, the task fails a "java.lang.NullPointerException" error that is shown on the build log.

環境

Bamboo Server or Data Center

診断

  1. Add a SCP task to your plan and select a shared artifact as your file to be transferred
  2. Run your plan
  3. In your build logs you can find the below error and stack trace:

    simple	08-Jul-2021 14:04:02	Starting task 'Publish Release Notes' of type 'com.atlassian.********.plugins.********-scp-plugin:scptask'
    error	08-Jul-2021 14:04:02	Error occurred while running Task 'Publish Release Notes(10)' of type com.atlassian.********.plugins.********-scp-plugin:scptask.
    error	08-Jul-2021 14:04:02	java.lang.NullPointerException
    error	08-Jul-2021 14:04:02		at java.io.File.<init>(File.java:362)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.plugins.scp.ScpTask$CopyPathSpecs.<init>(ScpTask.java:80)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.plugins.scp.ScpTask.getPathSpecToCopy(ScpTask.java:153)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.plugins.scp.ScpTask.run(ScpTask.java:117)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.plugins.scp.ScpTask.execute(ScpTask.java:106)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.task.TaskExecutorImpl.lambda$executeTasks$2(TaskExecutorImpl.java:317)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:252)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:317)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:112)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:204)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:176)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:131)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:125)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:127)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.utils.BambooRunnables$1.run(BambooRunnables.java:48)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
    error	08-Jul-2021 14:04:02		at com.atlassian.********.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
    error	08-Jul-2021 14:04:02		at java.lang.Thread.run(Thread.java:748)

原因


The artifact_definition table, used to store the definition of all your artifacts, has several columns for storing artifact name, pattern, location and so forth. When column src_directory on that table is NULL the SCP Task fails and throws the above errors when trying to fetch the artifact definition data. The reason why that column is NULL not yet known. To confirm if that's the case on your instance you can run the below query (please make sure to replace the build key with your own one:

select *
  from artifact_definition ad
  join build b
    on ad.producer_job_id = b.build_id
 where b.full_key = 'PROJ-PLAN-JOB'
   and ad.src_directory is null;

ソリューション

  1. Access your Bamboo instance URL https://<your-bamboo-URL>/build/admin/edit/defaultBuildArtifact.action?buildKey=PROJ-PLAN-JOB page and re-save the artifact definition for the artifact the shared artifact that you are using on your SCP task.
  2. Run your affected plan and confirm that the error is gone.

最終更新日 2021 年 7 月 19 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.