Upgrade to 2.11.3 (form 2.11.2) causes Configured `PolymorphicTypeValidator` (of type `com.fasterxml.jackson.databind.jsontype.BasicPolymorphicTypeValidator`) denied resolution
See original GitHub issueDescribe the bug After upgrading to 2.11.3 from 2.11.2, I receive the following exception:
Caused by: com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'org.jobrunr.jobs.context.JobDashboardLogger$JobDashboardLogLines' as a subtype of `java.lang.Object`: Configured `PolymorphicTypeValidator` (of type `com.fasterxml.jackson.databind.jsontype.BasicPolymorphicTypeValidator`) denied resolution
at [Source: (String)"{"version":0,"jobSignature":"System.out.println(String)","jobName":"an enqueued job","jobDetails":{"className":"java.lang.System","staticFieldName":"out","methodName":"println","jobParameters":[{"className":"java.lang.String","object":"a test"}]},"id":"4a322d0d-a90b-4835-b583-62dd7977a45e","jobHistory":[{"@class":"org.jobrunr.jobs.states.EnqueuedState","state":"ENQUEUED","createdAt":"2020-10-10T18:30:37.525349Z"},{"@class":"org.jobrunr.jobs.states.ProcessingState","state":"PROCESSING","createdAt"[truncated 769 chars]; line: 1, column: 723] (through reference chain: org.jobrunr.jobs.Job["metadata"]->java.util.concurrent.ConcurrentHashMap["jobRunrDashboardLog-2"])
at com.fasterxml.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:43)
at com.fasterxml.jackson.databind.DeserializationContext.invalidTypeIdException(DeserializationContext.java:1784)
at com.fasterxml.jackson.databind.DatabindContext._throwSubtypeClassNotAllowed(DatabindContext.java:287)
at com.fasterxml.jackson.databind.DatabindContext.resolveAndValidateSubType(DatabindContext.java:244)
at com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver._typeFromId(ClassNameIdResolver.java:72)
at com.fasterxml.jackson.databind.jsontype.impl.ClassNameIdResolver.typeFromId(ClassNameIdResolver.java:66)
Version information Which Jackson version(s) was this for? 2.11.3 (2.11.2 worked).
To Reproduce If you have a way to reproduce this with:
- Clone repository https://github.com/jobrunr/jobrunr
- Run tests in
core/src/test/java/org/jobrunr/utils/mapper
-> all tests green - In
platform/build.gradle
update the jackson dependency from2.11.2
to2.11.3
. - Comment lines to throw exception about incompatible Jackson version in
org.jobrunr.utils.mapper.jackson.JacksonJsonMapper
(lines 30-32) - Run tests in
core/src/test/java/org/jobrunr/utils/mapper
-> Jackson related tests are red
Json that fails during deserialization
{
"version": 0,
"jobSignature": "System.out.println(String)",
"jobName": "an enqueued job",
"jobDetails": {
"className": "java.lang.System",
"staticFieldName": "out",
"methodName": "println",
"jobParameters": [
{
"className": "java.lang.String",
"object": "a test"
}
]
},
"id": "6d9e0857-fd22-4b12-9fe2-19549d53b5bf",
"jobHistory": [
{
"@class": "org.jobrunr.jobs.states.EnqueuedState",
"state": "ENQUEUED",
"createdAt": "2020-10-10T18:56:16.346030Z"
},
{
"@class": "org.jobrunr.jobs.states.ProcessingState",
"state": "PROCESSING",
"createdAt": "2020-10-10T18:56:16.346997Z",
"serverId": "62c282de-b852-40f5-9cc9-a8c44e27dc23",
"updatedAt": "2020-10-10T18:56:16.346997Z"
}
],
"metadata": {
"@class": "java.util.concurrent.ConcurrentHashMap",
"jobRunrDashboardLog-2": {
"@class": "org.jobrunr.jobs.context.JobDashboardLogger$JobDashboardLogLines",
"logLines": [
{
"level": "INFO",
"logInstant": "2020-10-10T18:56:16.352182Z",
"logMessage": "this is an info message"
},
{
"level": "WARN",
"logInstant": "2020-10-10T18:56:16.352199Z",
"logMessage": "this is a warning message"
},
{
"level": "ERROR",
"logInstant": "2020-10-10T18:56:16.352205Z",
"logMessage": "this is an error message"
}
]
},
"jobRunrDashboardProgressBar-2": {
"@class": "org.jobrunr.jobs.context.JobDashboardProgressBar$JobDashboardProgress",
"totalAmount": 80,
"currentValue": 10,
"progress": 12
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
FasterXML - Bountysource
Upgrade to 2.11.3 (form 2.11.2) causes Configured `PolymorphicTypeValidator` (of type `com.fasterxml.jackson.databind.jsontype.
Read more >BasicPolymorphicTypeValidator (jackson-databind 2.11.0 API)
Set of specifically denied base types to indicate that use of specific base types is not allowed: most commonly used to fully block...
Read more >Index (jackson-databind 2.11.4 API) - javadoc.io
Method for constructing a bean deserializer that uses specified intermediate Builder for binding data, and construction of the value instance.
Read more >Add type information when serializing class with Jackson so ...
I actually got it working by configuring the ObjectMapper like this: ObjectMapper objectMapper = new ObjectMapper(); objectMapper.
Read more >Security update for jackson-databind, jackson-dataformats ...
CVE-2020-28491: Fixed a bug which could cause `java.lang.OutOfMemoryError` exception in jackson-dataformats-binary. (bsc#1182481). Non security ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The analysis of @kupci is correct - it is related to #2840.
Instead of using the PolymorphicTypeValidator below, I’m now using the
LaissezFaireSubTypeValidator.instance
(an excellent name by the way 😄 ).But I don’t understand why this would fail as the
JobDashboardLogger$JobDashboardLogLines
implementsJobContext.Metadata
. Any idea why my PolymorphicTypeValidator is not correct?I suspect the issue may have been due to validator not being registered; closing unless new information is uncovered.