Closed kering-wang closed 10 years ago
I tried your code and it works for me. The key issue is this exception
Caused by: java.lang.EnumConstantNotPresentException: org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion.NON_EMPTY
My guess is that you are using a different version of Jackson-mapper-asl. I am using version 1.9.8 which is what is included in the pom. My guess is that you have an older version.
It look like NON_EMPTY was included in 1.9.x versions and did not exist in prior versions. I tried 1.8.8 and saw the same thing you did.
On Wed, Nov 27, 2013 at 11:31 PM, kering-wang notifications@github.comwrote:
when i execute query with then kairos-client , i met a exception like this
Exception in thread "main" org.codehaus.jackson.map.JsonMappingException: org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion.NON_EMPTY (through reference chain: org.kairosdb.client.builder.QueryBuilder["metrics"]->java.util.ArrayList[0]) at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:215) at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:194) at org.codehaus.jackson.map.ser.SerializerBase.wrapAndThrow(SerializerBase.java:154) at org.codehaus.jackson.map.ser.ContainerSerializers$IndexedListSerializer.serializeContents(ContainerSerializers.java:278) at org.codehaus.jackson.map.ser.ContainerSerializers$IndexedListSerializer.serializeContents(ContainerSerializers.java:229) at org.codehaus.jackson.map.ser.ContainerSerializers$AsArraySerializer.serialize(ContainerSerializers.java:130) at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:428) at org.codehaus.jackson.map.ser.BeanSerializer.serializeFields(BeanSerializer.java:244) at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:211) at org.codehaus.jackson.map.ser.StdSerializerProvider.
serializeValue(StdSerializerProvider.java:586) at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:244) at org.codehaus.jackson.map.ObjectMapper. configAndWriteValue(ObjectMapper.java:1990) at org.codehaus.jackson.map.ObjectMapper.writeValue(ObjectMapper.java:1576) at org.kairosdb.client.builder.QueryBuilder.build(QueryBuilder.java:234) at org.kairosdb.client.AbstractClient.query(AbstractClient.java:82) at Get.main(Get.java:42) Caused by: java.lang.EnumConstantNotPresentException: org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion.NON_EMPTY at sun.reflect.annotation.EnumConstantNotPresentExceptionProxy.generateException(EnumConstantNotPresentExceptionProxy.java:47) at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:75) at sun.proxy.$Proxy6.include(Unknown Source) at org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector.findSerializationInclusion(JacksonAnnotationIntrospector.java:289) at org.codehaus.jackson.map.ser.PropertyBuilder.buildWriter(PropertyBuilder.java:108) at org.codehaus.jackson.map.ser.BeanSerializerFactory.
constructWriter(BeanSerializerFactory.java:727) at org.codehaus.jackson.map.ser.BeanSerializerFactory.findBeanProperties(BeanSerializerFactory.java:536) at org.codehaus.jackson.map.ser.BeanSerializerFactory.constructBeanSerializer(BeanSerializerFactory.java:375) at org.codehaus.jackson.map.ser.BeanSerializerFactory.findBeanSerializer(BeanSerializerFactory.java:291) at org.codehaus.jackson.map.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:241) at org.codehaus.jackson.map.ser.StdSerializerProvider. createUntypedSerializer(StdSerializerProvider.java:747) at org.codehaus.jackson.map.ser.StdSerializerProvider.
createAndCacheUntypedSerializer(StdSerializerProvider.java:688) at org.codehaus.jackson.map.ser.StdSerializerProvider.findValueSerializer(StdSerializerProvider.java:363) at org.codehaus.jackson.map.ser.impl.PropertySerializerMap.findAndAddSerializer(PropertySerializerMap.java:39) at org.codehaus.jackson.map.ser.ContainerSerializers$AsArraySerializer. findAndAddDynamic(ContainerSerializers.java:209) at org.codehaus.jackson.map.ser.ContainerSerializers$IndexedListSerializer.serializeContents(ContainerSerializers.java:271) ... 12 more
the execute code like this
QueryBuilder builder = QueryBuilder.getInstance();
builder.setStart(Calendar.getInstance().getTime()).addMetric("kairosdb.jvm.free_memory"); HttpClient client = new HttpClient("10.11.0.9", 8015); QueryResponse response = client.query(builder); System.out.println("Response Code =" + response.getStatusCode());
client.shutdown();
— Reply to this email directly or view it on GitHubhttps://github.com/proofpoint/kairosdb-client/issues/8 .
Moved from Jackson to Gson.
when i execute query with then kairos-client , i met a exception like this
Exception in thread "main" org.codehaus.jackson.map.JsonMappingException: org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion.NON_EMPTY (through reference chain: org.kairosdb.client.builder.QueryBuilder["metrics"]->java.util.ArrayList[0]) at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:215) at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:194) at org.codehaus.jackson.map.ser.SerializerBase.wrapAndThrow(SerializerBase.java:154) at org.codehaus.jackson.map.ser.ContainerSerializers$IndexedListSerializer.serializeContents(ContainerSerializers.java:278) at org.codehaus.jackson.map.ser.ContainerSerializers$IndexedListSerializer.serializeContents(ContainerSerializers.java:229) at org.codehaus.jackson.map.ser.ContainerSerializers$AsArraySerializer.serialize(ContainerSerializers.java:130) at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:428) at org.codehaus.jackson.map.ser.BeanSerializer.serializeFields(BeanSerializer.java:244) at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:211) at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:586) at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:244) at org.codehaus.jackson.map.ObjectMapper._configAndWriteValue(ObjectMapper.java:1990) at org.codehaus.jackson.map.ObjectMapper.writeValue(ObjectMapper.java:1576) at org.kairosdb.client.builder.QueryBuilder.build(QueryBuilder.java:234) at org.kairosdb.client.AbstractClient.query(AbstractClient.java:82) at Get.main(Get.java:42) Caused by: java.lang.EnumConstantNotPresentException: org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion.NON_EMPTY at sun.reflect.annotation.EnumConstantNotPresentExceptionProxy.generateException(EnumConstantNotPresentExceptionProxy.java:47) at sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:75) at sun.proxy.$Proxy6.include(Unknown Source) at org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector.findSerializationInclusion(JacksonAnnotationIntrospector.java:289) at org.codehaus.jackson.map.ser.PropertyBuilder.buildWriter(PropertyBuilder.java:108) at org.codehaus.jackson.map.ser.BeanSerializerFactory._constructWriter(BeanSerializerFactory.java:727) at org.codehaus.jackson.map.ser.BeanSerializerFactory.findBeanProperties(BeanSerializerFactory.java:536) at org.codehaus.jackson.map.ser.BeanSerializerFactory.constructBeanSerializer(BeanSerializerFactory.java:375) at org.codehaus.jackson.map.ser.BeanSerializerFactory.findBeanSerializer(BeanSerializerFactory.java:291) at org.codehaus.jackson.map.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:241) at org.codehaus.jackson.map.ser.StdSerializerProvider._createUntypedSerializer(StdSerializerProvider.java:747) at org.codehaus.jackson.map.ser.StdSerializerProvider._createAndCacheUntypedSerializer(StdSerializerProvider.java:688) at org.codehaus.jackson.map.ser.StdSerializerProvider.findValueSerializer(StdSerializerProvider.java:363) at org.codehaus.jackson.map.ser.impl.PropertySerializerMap.findAndAddSerializer(PropertySerializerMap.java:39) at org.codehaus.jackson.map.ser.ContainerSerializers$AsArraySerializer._findAndAddDynamic(ContainerSerializers.java:209) at org.codehaus.jackson.map.ser.ContainerSerializers$IndexedListSerializer.serializeContents(ContainerSerializers.java:271) ... 12 more
the execute code like this
QueryBuilder builder = QueryBuilder.getInstance(); builder.setStart(Calendar.getInstance().getTime()).addMetric("kairosdb.jvm.free_memory"); HttpClient client = new HttpClient("10.11.0.9", 8015); QueryResponse response = client.query(builder); System.out.println("Response Code =" + response.getStatusCode());