Search code examples
javagroovychef-infrajclouds

JClouds-Chef BootstrapConfig Builder MissingMethodException


Please note: although this question involve the JClouds-Chef library and Groovy here, I think this is a Java API question at heart.

On JClouds-Chef 1.7.3 here:

List<String> runlist = new RunListBuilder().addRole("typicalapp").build();

ArrayList<String> runList2 = new ArrayList<String>();
for(String item : runlist) {
    runList2.add(item);
}

System.out.println("runList2 is of type: " + runList2.getClass().getName());

BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runlist(runList2).build();

Produces the following output/exception:

runList2 is of type: java.util.ArrayList
Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: org.jclouds.chef.domain.BootstrapConfig$Builder.runlist() is applicable for argument types: (java.util.ArrayList) values: [[role[typicalapp]]]
Possible solutions: runList(java.lang.Iterable), build(), split(groovy.lang.Closure)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
    at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at net.myuser.chef.test.ChefPlugin.provision(ChefPlugin.groovy:71)
    at net.myuser.chef.test.ChefPlugin$provision.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at net.myuser.chef.test.ChefPlugin.main(ChefPlugin.groovy:27)

I'm pretty sure the code for this version of BootstrapConfig#Builder is here. As far as I can tell, ArrayList extends Iterable, so I can't see what's going on here.


Solution

  • You are using runlist instead of runList