JsonMappingException Duplicate property ... for [simple type, class java.lang.Exception]

Josh

I am trying to map a valid json string to a POJO with code that worked about 2 weeks ago. I have made no changes to the code in those 2 weeks.

My json string is valid according to http://jsonformatter.curiousconcept.com/.

I am using Jackson to map the json to the POJO:

response = new ObjectMapper().readValue(validJsonString, response.class);

This worked before! Now I get the following error. Any insights would be appreciated. I cannot find anything relating to this error message (in the title and first line of the stacktrace).

org.codehaus.jackson.map.JsonMappingException: Duplicate property 'cause' for [simple type, class java.lang.Exception]
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCache2(StdDeserializerProvider.java:267)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCacheValueDeserializer(StdDeserializerProvider.java:242)
at org.codehaus.jackson.map.deser.StdDeserializerProvider.findValueDeserializer(StdDeserializerProvider.java:111)
at org.codehaus.jackson.map.deser.BasicDeserializerFactory.createCollectionDeserializer(BasicDeserializerFactory.java:178)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createDeserializer(StdDeserializerProvider.java:330)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCache2(StdDeserializerProvider.java:262)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCacheValueDeserializer(StdDeserializerProvider.java:242)
at org.codehaus.jackson.map.deser.StdDeserializerProvider.findValueDeserializer(StdDeserializerProvider.java:111)
at org.codehaus.jackson.map.deser.StdDeserializer.findDeserializer(StdDeserializer.java:307)
at org.codehaus.jackson.map.deser.BeanDeserializer.resolve(BeanDeserializer.java:246)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._resolveDeserializer(StdDeserializerProvider.java:346)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCache2(StdDeserializerProvider.java:301)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCacheValueDeserializer(StdDeserializerProvider.java:242)
at org.codehaus.jackson.map.deser.StdDeserializerProvider.findValueDeserializer(StdDeserializerProvider.java:111)
at org.codehaus.jackson.map.deser.StdDeserializerProvider.findTypedValueDeserializer(StdDeserializerProvider.java:127)
at org.codehaus.jackson.map.ObjectMapper._findRootDeserializer(ObjectMapper.java:1655)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:1588)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1116)
at com.jpmorgan.wm.svc.client.coverage.WmSvcLogAnalytics.getMosaicTraceIdStatus(WmSvcLogAnalytics.java:178)
at com.jpmorgan.wm.svc.client.coverage.WmSvcLogAnalytics.getLogAnalyticsLogEventDetails(WmSvcLogAnalytics.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:168)
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:70)
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:86)
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:74)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1357)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1289)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1239)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:497)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:684)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1661)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:944)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:507)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:181)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:878)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:191)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1660)
Caused by: 
java.lang.IllegalArgumentException: Duplicate property 'cause' for [simple type, class java.lang.Exception]
at org.codehaus.jackson.map.deser.BeanDeserializer.addProperty(BeanDeserializer.java:187)
at org.codehaus.jackson.map.deser.BeanDeserializerFactory.buildThrowableDeserializer(BeanDeserializerFactory.java:164)
at org.codehaus.jackson.map.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:95)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createDeserializer(StdDeserializerProvider.java:340)
at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCache2(StdDeserializerProvider.java:262)
... 56 more
Josh

This does not answer the question exactly as written, but is the final solution to my problem.

I have refactored my code, which ultimately has led to some code reduction.

I no longer map the JSON to a java object. After inspecting my code, I realized I do very little processing on the java object, before it is reseralied back into JSON and sent out of a Jersey REST service to the front end.

So I am now simply directly returning the JSON string as a string instead of a java object to be serialized into JSON by Jersey.

That being said, I still have no idea what the actual issue is (was). I would still be open to hearing others' thoughts on the exception. For now though, I have a better solution.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Duplicate property '' for [simple type, on Deserialization

com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [simple type, class java.time.LocalDateTime] from String

nested exception is java.lang.IllegalArgumentException: Not a managed type: class

JsonMappingException: No suitable constructor found for type [simple type, class ]: can not instantiate from JSON object

Exception in thread "main" java.lang.ClassFormatError: Duplicate method name "setName" with signature "(Ljava.lang.String;)V" in class file Parent

Problem deserializing property 'created' (expected type: [simple type, class java.time.LocalDate]

Weird exception "Invalid receiver type class java.lang.Object; not a subtype of ..."

JsonMappingException while serializing : (was java.lang.ArrayIndexOutOfBoundsException)

Micronaut CompileStatic JSON object -Static type checking- No such property: bookid for class: java.lang.Object

Is there a simple way to add a class to java.lang

No such property: split for class: java.lang.String

No such property: id for class: java.lang.String

Exception: "org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token"

IllegalArgumentException: Cannot convert PROPERTY of type class org.omnifaces.el.ExpressionInspector$ValueExpressionType to class java.lang.Boolean

Exception: java.lang.NoClassDefFoundError - org/json/simple/JSONValue

java.lang.IllegalArgumentException: Not a managed type: class

Java Type Class Exception from String

Simple way to get wrapper class type in Java

nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type

Exception in main java.lang.ClassCastException:class java.lang.String can't be cast to class

java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonMappingException

Reason for the exception java.lang.VerifyError: Bad type on operand stack

No qualifying bean of type java.lang.String exception for normal field

exception is java.lang.IllegalStateException: Could not load JDBC driver class

Exception in thread "main" java.lang.NullPointerException virtual stack class

Simple code to get java.lang.reflect.Type

Failed to convert property value of type 'java.lang.String'

Failed to convert property value of type [java.lang.String]

No such property: compile for class: java.lang.String in android studio

TOP Ranking

HotTag

Archive