question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InvalidDefinitionException after upgrading from 2.9.1 to 2.9.2

See original GitHub issue

This is (re)submission of https://github.com/FasterXML/jackson-databind/issues/1817 after @cowtowncoder asked me to submit it here.

I’m using Kotlin and I’ve just upgraded from Jackson version 2.9.1 to 2.9.2. Previously the following was working:

val parsed = jsonMapper.readValue(result.output, DockerHealthCheckStatus::class.java)

But now it fails with the following exception:

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Invalid definition for property `Log` (of type `batect.docker.DockerClient$DockerHealthCheckStatus`): Could not find creator property with name 'Log' (known Creator properties: [log])
 at [Source: (String)"{
                                  "Status": "unhealthy",
                                  "FailingStreak": 130,
                                  "Log": [
                                    {
                                      "Start": "2017-10-04T00:54:23.608075352Z",
                                      "End": "2017-10-04T00:54:23.646606606Z",
                                      "ExitCode": 1,
                                      "Output": "something went wrong"
                    "[truncated 87 chars]; line: 1, column: 1]
        at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:62)
        at com.fasterxml.jackson.databind.DeserializationContext.reportBadPropertyDefinition(DeserializationContext.java:1446)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.addBeanProps(BeanDeserializerFactory.java:607)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:269)
        at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:179)
        at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:411)
        at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349)
        at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)
        at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
        at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
        at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:477)
        at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4178)
        at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3997)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2992)
        at batect.docker.DockerClient.getLastHealthCheckResult(DockerClient.kt:249)

Parser is set up with:

    private val jsonMapper by lazy {
        val mapper = jacksonObjectMapper()
        mapper.propertyNamingStrategy = PropertyNamingStrategy.UPPER_CAMEL_CASE
        mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)

        mapper
    }

DockerHealthCheckStatus is defined as:

    private data class DockerHealthCheckStatus(val log: List<DockerHealthCheckResult>)

Am I doing something wrong or is this a bug introduced in 2.9.2?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
cienijrcommented, Mar 6, 2018

@apatrida I can confirm that this bug is also affecting single-constructor data class with a parameter other than a string. In my case, the class holds a single UUID? property:

Invalid definition for property `account_id` (of type `com.movile.kiwi.ws.web.controller.event.v2.to.AccountInfoTO`): Could not find creator property with name 'account_id' (known Creator properties: [accountId])
 at [Source: (com.movile.kiwi.ws.web.filter.model.ResettableStreamHttpServletRequest$ResettableServletInputStream); line: 1, column: 1]

The class definition is:

data class AccountInfoTO(val accountId: UUID?)

If I add an explicit @JsonProperty annotation or add a dummy empty property the binding works as expected.

0reactions
apatridacommented, Jul 18, 2018

I think all issues mentioned here are resolved in current releases (or master branch of this plugin)

Read more comments on GitHub >

github_iconTop Results From Across the Web

InvalidDefinitionException after upgrading from 2.9.1 to 2.9.2
I'm using Kotlin and I've just upgraded from Jackson version 2.9.1 to 2.9.2. Previously the following was working: val parsed = jsonMapper.
Read more >
Unable to start application after upgrading jackson-databind ...
I am working on a spring boot application, I want to upgrade jackson-databind from 2.9.10.2 to 2.10.2. Below is snippet from my pom.xml...
Read more >
Duplicate proprety ID with Jackson 2.9.2+ - Google Groups
After upgrading Jackson to 2.9.5 (which Dw uses), Jackson (since 2.9.2) ... InvalidDefinitionException: Duplicate creator property "id" (index 0 vs 1) at ...
Read more >
Upgrade to latest OO version from previous versions
When you upgrade to Operations Orchestration 2019.11, this installs the trial version. Install a commercial license within 90 days.
Read more >
DeserializationContext (jackson-databind 2.9.9 API) - Javadoc.io
Method for deserializers to call when the token encountered was of type different than what should be seen at that position, usually within...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found