Description
Today I run into an issue similar with KARAF-1173, I encounter exception like
javax.management.openmbean.KeyAlreadyExistsException: Argument value's index, calculated according to this TabularData instance's tabularType, already refers to a value in this table.
at javax.management.openmbean.TabularDataSupport.checkValueAndIndex(TabularDataSupport.java:871)
at javax.management.openmbean.TabularDataSupport.internalPut(TabularDataSupport.java:331)
at javax.management.openmbean.TabularDataSupport.put(TabularDataSupport.java:323)
at org.apache.karaf.features.management.codec.JmxFeature.getFeatureIdentifierTable(JmxFeature.java:105)
at org.apache.karaf.features.management.codec.JmxFeature.<init>(JmxFeature.java:75)
at org.apache.karaf.features.management.internal.FeaturesServiceMBeanImpl.getFeatures(FeaturesServiceMBeanImpl.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:93)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:27)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:208)
at com.sun.jmx.mbeanserver.PerInterface.getAttribute(PerInterface.java:65)
at com.sun.jmx.mbeanserver.MBeanSupport.getAttribute(MBeanSupport.java:216)
at com.sun.jmx.mbeanserver.MBeanSupport.getAttributes(MBeanSupport.java:223)
I figured out the root cause is that in jclouds-karaf-1.3.2_1-features.xml,
the jclouds-go2cloud-jhb1 feature has two jclouds feature dependencies like
<feature name='jclouds-go2cloud-jhb1' description='Go2Cloud implementation targeted to Johannesburg1' version='1.3.2_1' resolver='(obr)'>
<feature version='1.3.2_1'>jclouds</feature>
<feature version='1.3.2_1'>jclouds</feature>
<feature version='1.3.2_1'>jclouds-driver-jsch</feature>
<bundle>mvn:org.jclouds.api/elasticstack/1.3.2</bundle>
<bundle>mvn:org.jclouds.provider/go2cloud-jhb1/1.3.2</bundle>
</feature>
there are two jclouds here and hence try to add jclouds twice into mbeans TabularDataSupport which cause KeyAlreadyExistsException
Though this should be fixed in jclouds side, I think the Karaf features management should be more robust to honor this duplicated feature names