You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static void main(String[] args) throws IOException
{
GlobalMetricID txnID = new GlobalMetricID();
txnID.appId = new ObjectId("530a4bf1fe0e15115a197577");
txnID.metricId = 1;
txnID.metricName = "hello";
Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer(GlobalMetricID.class);
byte[] bytes = serializer.serialize(txnID);
String s1 = new String(bytes);
System.out.println(s1);
Object deserialize = serializer.deserialize(bytes);
System.out.println(deserialize);
}
results in this
{"appId":{"time":1393183729000,"date":1393183729000,"timestamp":1393183729,"machine":-32631535,"timeSecond":1393183729,"new":false,"inc":1511617911},"metricName":"hello","metricId":1,"name":"hello"}
Exception in thread "main" org.springframework.data.redis.serializer.SerializationException: Could not read JSON: Unrecognized field "time" (class org.bson.types.ObjectId), not marked as ignorable (0 known properties: ])
at [Source: [B@4387b79e; line: 1, column: 31] (through reference chain: com.dripstat.metricprocessor.mongo.GlobalMetricID["appId"]->org.bson.types.ObjectId["time"]); nested exception is com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "time" (class org.bson.types.ObjectId), not marked as ignorable (0 known properties: ])
at [Source: [B@4387b79e; line: 1, column: 31] (through reference chain: com.dripstat.metricprocessor.mongo.GlobalMetricID["appId"]->org.bson.types.ObjectId["time"])
at org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer.deserialize(Jackson2JsonRedisSerializer.java:73)
at com.dripstat.metricprocessor.metric.caches.MetricIdCache.main(MetricIdCache.java:120)
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "time" (class org.bson.types.ObjectId), not marked as ignorable (0 known properties: ])
at [Source: [B@4387b79e; line: 1, column: 31] (through reference chain: com.dripstat.metricprocessor.mongo.GlobalMetricID["appId"]->org.bson.types.ObjectId["time"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51)
at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:731)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:915)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1298)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1276)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:243)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:538)
at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:106)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:238)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2255)
at org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer.deserialize(Jackson2JsonRedisSerializer.java:71)
... 1 more
This means anyone trying to cache mongodb documents using redis will face this exception.
This is a critical exception since the error is thrown during deserialization, so users will fill up their cache with data that cannot be serialized
Affects: 1.5 GA (Fowler)
Issue Links:
DATAREDIS-390 json serializer only allows single type
Prashant Deva opened DATAREDIS-392 and commented
This code:
results in this
This means anyone trying to cache mongodb documents using redis will face this exception.
This is a critical exception since the error is thrown during deserialization, so users will fill up their cache with data that cannot be serialized
Affects: 1.5 GA (Fowler)
Issue Links:
Referenced from: pull request #145
Backported to: 1.5.3 (Fowler SR3)
1 votes, 3 watchers
The text was updated successfully, but these errors were encountered: