[ https://issues.apache.org/jira/browse/JCLOUDS-377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13820182#comment-13820182 ]
Ignasi Barrera edited comment on JCLOUDS-377 at 11/12/13 3:27 PM: ------------------------------------------------------------------ [~jayant_kaushal] this was fixed as part of the linked issue. The problem here is that at some point, the Chef Server api in Chef 11 (and Hosted Chef) started to return duplicate keys when requesting the cookbook information. The fix is part of a major refactor of jclouds-chef to make it compatible with Chef 11 and Enterprise Chef, and that is why this was not backported to 1.6. Upgrading to the latest 1.7 version should fix your issue. was (Author: nacx): [~jayant_kaushal] this was fixed as part of the linked issue. The problem here is that at some point, the Chef Server api in Chef 11 (and hosted Chef) started to return duplicate keys when requesting the cookbook information. The fix is part of a major refactor of jclouds-chef to make it compatible with Chef 11 and Enterprise Chef, and that is why this was not backported to 1.6. Upgrading to the latest 1.7 version should fix your issue. > Error in fetching cookbooks from chef server > -------------------------------------------- > > Key: JCLOUDS-377 > URL: https://issues.apache.org/jira/browse/JCLOUDS-377 > Project: jclouds > Issue Type: Bug > Components: jclouds-chef > Affects Versions: 1.6.0 > Reporter: Jayant Kaushal > Assignee: Ignasi Barrera > Labels: hostedchef > Fix For: 1.7.0 > > > I am trying to fetch cookboks from my opscode hosted chef account.some > cookbooks seems to fetch fine. for example > chef_handler,bluepill,build-essential however when i try to fetch apache2, > mysql that are there on my hosted chef server, > This is what i am trying to do. > ChefApi api = getAPI(); > Set<String> cookbooks = api.listCookbooks(); > for(String cookBook : cookbooks) { > Set<String> versionsOfCookbook = api.getVersionsOfCookbook(cookBook); > for(String s : versionsOfCookbook) { > CookbookVersion cookbook = api.getCookbook(cookBook, s); > } > But this throws exception for apache2, please take a look > SEVERE: Error parsing input > java.lang.IllegalArgumentException: duplicate key: apache2 > at > com.google.common.base.Preconditions.checkArgument(Preconditions.java:119) > at > com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:67) > at > com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:249) > at > com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:235) > at > org.jclouds.json.internal.NullFilteringTypeAdapterFactories$MapTypeAdapter.read(NullFilteringTypeAdapterFactories.java:313) > at > org.jclouds.json.internal.NullFilteringTypeAdapterFactories$MapTypeAdapter.read(NullFilteringTypeAdapterFactories.java:278) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) > at com.google.gson.Gson.fromJson(Gson.java:755) > at com.google.gson.Gson.fromJson(Gson.java:721) > at com.google.gson.Gson.fromJson(Gson.java:670) > at org.jclouds.json.internal.GsonWrapper.fromJson(GsonWrapper.java:47) > at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:86) > at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:80) > at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:66) > at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:46) > at > org.jclouds.rest.internal.InvokeHttpMethod$InvokeAndTransform.call(InvokeHttpMethod.java:167) > at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > at java.lang.Thread.run(Thread.java:662) > 20:20:03,274 ERROR [DispatcherPortlet:560] Could not complete request > java.lang.IllegalArgumentException: duplicate key: apache2 > at > com.google.common.base.Preconditions.checkArgument(Preconditions.java:119) > at > com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:67) > at > com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:249) > at > com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:235) > at > org.jclouds.json.internal.NullFilteringTypeAdapterFactories$MapTypeAdapter.read(NullFilteringTypeAdapterFactories.java:313) > at > org.jclouds.json.internal.NullFilteringTypeAdapterFactories$MapTypeAdapter.read(NullFilteringTypeAdapterFactories.java:278) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) > at > com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) > at com.google.gson.Gson.fromJson(Gson.java:755) > at com.google.gson.Gson.fromJson(Gson.java:721) > at com.google.gson.Gson.fromJson(Gson.java:670) > at org.jclouds.json.internal.GsonWrapper.fromJson(GsonWrapper.java:47) > at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:86) > at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:80) > at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:66) > at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:46) > at > org.jclouds.rest.internal.InvokeHttpMethod$InvokeAndTransform.call(InvokeHttpMethod.java:167) > at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > at java.lang.Thread.run(Thread.java:662) > Chef Verison is 1.6.0, > Thanks in advance > Jayant -- This message was sent by Atlassian JIRA (v6.1#6144)