Quantcast
Channel: zeroturnaround.com » All Posts
Viewing all articles
Browse latest Browse all 2540

Issue with Jackson 2.7.0

$
0
0

Hi,

I’m experiencing an issue when reloading POJO classes that are used to serialize/deserialize JSON with Jackson 2.7.0.
Symptoms include:

1. new fields not being recognised
2. NoSuchMethodError when removing fields
3. creating a new ObjectMapper instance does not fix it.

After some digging I found that the source of the problem is in com.fasterxml.jackson.databind.util.ClassUtil.
Seems like in 2.7 a static ClassMeta cache was added.

I created a temporary workaround. Before each ObjectMapper use, call this code:


    Field field = ClassUtil.class.getDeclaredField("sCached");
    field.setAccessible(true);
    ((LRUMap<Class<?>, ClassMetadata>) field.get(null)).clear();

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>