Java Ninja Chronicles By Norris Shelton

Things I learned in the pursuit of code

I had a RESTful call to a dotCMS 2.x server worked out. I called it later in the day and a new property was being sent. This resulted in the following exception.

Method threw 'com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException' exception.
class com.cdi.igp.models.dotcms.PokerClient
stInode
 size = 3
 (3 known properties: "version", "whatsNew", "clientType"])
 size = 3
[Source: {"contentlets":[{...removed for brevity...}]}; line: 1, column: 29]
Unrecognized field "stInode" (class com.cdi.igp.models.dotcms.PokerClient), not marked as ignorable
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "stInode" (class com.cdi.igp.models.dotcms.PokerClient), not marked as ignorable (3 known properties: "version", "whatsNew", "clientType"])
 at [Source: ...removed for brevity...]}; line: 1, column: 29] (through reference chain: com.cdi.igp.core.dotcms.DotCmsPokerClientResponse["contentlets"]->java.util.ArrayList[0]->com.cdi.igp.models.dotcms.PokerClient["stInode"])

 size = 0

I fixed it by adding the following to the top of the class that I was mapping the data into.

@JsonIgnoreProperties(ignoreUnknown = true)

Problem solved.

February 3rd, 2015

Posted In: Java, java ninja, Javaninja

Tags: , , , , , , ,

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

LinkedIn Auto Publish Powered By : XYZScripts.com