Plan created with Bamboo Java Specs Exception on VCS Checkout
Asked by Johannes A:

Hi all, I have successfully created a repository hosted plan spec and imported it into Bamboo.

When I run the plan, it fails with the following error message:

```
simple	19-Sep-2018 17:35:35	Build Bamboo Test Plans1 - Bamboo WLP SPEC Deployment Test - Build #3 (BAMBOOXX2-BMDTSPEC-JOB1-3) started building on agent k8s-agent-exp-7ffc6db88d-78jlcsimple	19-Sep-2018 17:35:35	Remote agent on host k8s-agent-exp-7ffc6db88d-78jlcsimple	19-Sep-2018 17:35:35	Build working directory is /usr/local/bamboo/agent-home/xml-data/build-dir/BAMBOOXX2-BMDTSPEC-JOB1simple	19-Sep-2018 17:35:35	Executing build Bamboo Test Plans1 - Bamboo WLP SPEC Deployment Test - Build #3 (BAMBOOXX2-BMDTSPEC-JOB1-3)simple	19-Sep-2018 17:35:35	Starting task 'Checkout Default Repository' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'simple	19-Sep-2018 17:35:35	Checking out into /usr/local/bamboo/agent-home/xml-data/build-dir/BAMBOOXX2-BMDTSPEC-JOB1simple	19-Sep-2018 17:35:35	Updating source code to revision: 76f11ac697852c5dfa26b18f676a27f878ad3becsimple	19-Sep-2018 17:35:35	Creating local git repository in '/usr/local/bamboo/agent-home/xml-data/build-dir/BAMBOOXX2-BMDTSPEC-JOB1/.git'.simple	19-Sep-2018 17:35:35	Initialized empty Git repository in /usr/local/bamboo/agent-home/xml-data/build-dir/BAMBOOXX2-BMDTSPEC-JOB1/.git/error	19-Sep-2018 17:35:36	Error occurred while running Task 'Checkout Default Repository(1)' of type com.atlassian.bamboo.plugins.vcs:task.vcs.checkout.error	19-Sep-2018 17:35:36	com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.writeStringToFile(Ljava/io/File;Ljava/lang/String;Ljava/nio/charset/Charset;)Verror	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache.get(LocalCache.java:3937)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.utils.collections.AlwaysInvalidatingCacheDecorator.get(AlwaysInvalidatingCacheDecorator.java:65)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.utils.collections.AlwaysInvalidatingCacheDecorator.getUnchecked(AlwaysInvalidatingCacheDecorator.java:126)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.util.CallableResultCache.call(CallableResultCache.java:141)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getRemoteRefs(NativeGitOperationHelper.java:593)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.resolveBranch(NativeGitOperationHelper.java:545)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getRefsToFetch(NativeGitOperationHelper.java:535)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.fetch(NativeGitOperationHelper.java:496)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.checkout(GitWorkingCopyManager.java:242)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.retrieveSourceCode(GitWorkingCopyManager.java:74)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerWorkingCopyManager.retrieveSourceCode(BitbucketServerWorkingCopyManager.java:78)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.fillWorkingDirFromVcs(VcsCheckoutTask.java:206)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.execute(VcsCheckoutTask.java:119)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$3(TaskExecutorImpl.java:288)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:221)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:288)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.task.TaskExecutorImpl.executePreparationTasks(TaskExecutorImpl.java:90)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.build.pipeline.tasks.PrepareBuildTask.call(PrepareBuildTask.java:81)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:203)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:175)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:122)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:117)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:126)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)error	19-Sep-2018 17:35:36		at java.lang.Thread.run(Thread.java:745)error	19-Sep-2018 17:35:36	Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.writeStringToFile(Ljava/io/File;Ljava/lang/String;Ljava/nio/charset/Charset;)Verror	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2201)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache.get(LocalCache.java:3937)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.util.SharedTemporaryFiles.create(SharedTemporaryFiles.java:190)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getSshScriptToRun(GitCommandProcessor.java:160)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.git.GitCommandProcessor.createRemoteCommandBuilder(GitCommandProcessor.java:604)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getRemoteRefs(GitCommandProcessor.java:480)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.lambda$getRemoteRefs$1(NativeGitOperationHelper.java:585)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:38)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:34)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)error	19-Sep-2018 17:35:36		... 31 moreerror	19-Sep-2018 17:35:36	Caused by: java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.writeStringToFile(Ljava/io/File;Ljava/lang/String;Ljava/nio/charset/Charset;)Verror	19-Sep-2018 17:35:36		at com.atlassian.bamboo.util.SharedTemporaryFiles.createTempFile(SharedTemporaryFiles.java:147)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.util.SharedTemporaryFiles.access$200(SharedTemporaryFiles.java:20)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.util.SharedTemporaryFiles$1.load(SharedTemporaryFiles.java:140)error	19-Sep-2018 17:35:36		at com.atlassian.bamboo.util.SharedTemporaryFiles$1.load(SharedTemporaryFiles.java:137)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)error	19-Sep-2018 17:35:36		at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)error	19-Sep-2018 17:35:36		... 45 more
```

Any idea how to fix this?

Here is the plan spec:

{code}

package com.mycomp.bamboo;  

import com.atlassian.bamboo.specs.api.BambooSpec;  
import com.atlassian.bamboo.specs.api.builders.BambooKey;  
import com.atlassian.bamboo.specs.api.builders.Variable;  
import com.atlassian.bamboo.specs.api.builders.permission.PermissionType;  
import com.atlassian.bamboo.specs.api.builders.permission.Permissions;  
import com.atlassian.bamboo.specs.api.builders.permission.PlanPermissions;  
import com.atlassian.bamboo.specs.api.builders.plan.Job;  
import com.atlassian.bamboo.specs.api.builders.plan.Plan;  
import com.atlassian.bamboo.specs.api.builders.plan.PlanIdentifier;  
import com.atlassian.bamboo.specs.api.builders.plan.Stage;  
import com.atlassian.bamboo.specs.api.builders.plan.artifact.Artifact;  
import com.atlassian.bamboo.specs.api.builders.plan.branches.BranchCleanup;  
import com.atlassian.bamboo.specs.api.builders.plan.branches.PlanBranchManagement;  
import com.atlassian.bamboo.specs.api.builders.plan.configuration.ConcurrentBuilds;  
import com.atlassian.bamboo.specs.api.builders.project.Project;  
import com.atlassian.bamboo.specs.builders.task.CheckoutItem;  
import com.atlassian.bamboo.specs.builders.task.MavenTask;  
import com.atlassian.bamboo.specs.builders.task.VcsCheckoutTask;  
import com.atlassian.bamboo.specs.builders.trigger.BitbucketServerTrigger;  
import com.atlassian.bamboo.specs.util.BambooServer;  

@BambooSpec  
public class PlanSpec {  

public Plan plan() {  
final Plan plan = new Plan(new Project()  
.key(new BambooKey("BAMBOO"))  
.name("Bamboo Test Plans"),  
"Bamboo SPEC Test",  
new BambooKey("BSPEC"))  
.description("My description")  
.pluginConfigurations(new ConcurrentBuilds()  
.useSystemWideDefault(false))  
.stages(new Stage("Default Stage")  
.jobs(new Job("Build",  
new BambooKey("JOB1"))  
.artifacts(new Artifact()  
.name("wlp")  
.copyPattern("\*\*/\*")  
.location("wlp-simple-server/src")  
.shared(true),  
new Artifact()  
.name("wlp-simple-web")  
.copyPattern("\*.war")  
.location("wlp-simple-web/target")  
.shared(true),  
new Artifact()  
.name("wlp-server-pom")  
.copyPattern("pom.xml")  
.location("wlp-simple-server")  
.shared(true),  
new Artifact()  
.name("wlp-final.zip")  
.copyPattern("wlp-final.zip")  
.location("wlp-simple-server")  
.shared(true))  
.tasks(new VcsCheckoutTask()  
.description("Checkout Default Repository")  
.checkoutItems(new CheckoutItem().defaultRepository()),  
new MavenTask()  
.description("Build Web Module")  
.goal("clean package -Dmodule.build.id=Bamboo-${bamboo.buildResultKey} -Dmodule.build.revision=${bamboo.repository.revision.number} -U")  
.projectFile("wlp-simple-web/pom.xml")  
.jdk("IBM SDK 1.8.0")  
.executableLabel("Maven 3.3.3"))))  
.linkedRepositories("Examples")  

.triggers(new BitbucketServerTrigger())  
.variables(new Variable("my.password.test",  
"BAMSCRT@0@0@blablabla=="))  
.planBranchManagement(new PlanBranchManagement()  
.delete(new BranchCleanup())  
.notificationForCommitters());  
return plan;  
}  

public PlanPermissions planPermission() {  
final PlanPermissions planPermission = new PlanPermissions(new PlanIdentifier("BAMBOO", "BSPEC"))  
.permissions(new Permissions()  
.userPermissions("USER1", PermissionType.ADMIN, PermissionType.VIEW, PermissionType.CLONE, PermissionType.BUILD, PermissionType.EDIT)  
.userPermissions("USER2", PermissionType.EDIT, PermissionType.VIEW, PermissionType.ADMIN, PermissionType.CLONE, PermissionType.BUILD)  
.loggedInUserPermissions(PermissionType.VIEW)  
.anonymousUserPermissionView());  
return planPermission;  
}  

public static void main(String... argv) {  
//By default credentials are read from the '.credentials' file.  
BambooServer bambooServer = new BambooServer("<https://bamboo-exp.swissre.com>");  
final PlanSpec planSpec = new PlanSpec();  

final Plan plan = planSpec.plan();  
bambooServer.publish(plan);  

final PlanPermissions planPermission = planSpec.planPermission();  
bambooServer.publish(planPermission);  
}  
}

{code}


Answers:
author: Gabriel Ribeiro
body: Hi Johannes,

The error doesn't seem to be related to the fact that the plan was created using specs. Are there other plans passing in this same agent (k8s-agent-exp-7ffc6db88d-78jlc)?

thanks.