-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
Deserializing an exception class from json on Google App Engine causes this error:
Caused by: java.lang.IllegalArgumentException: Can not access private java.lang.Throwable java.lang.Throwable.cause (from class java.lang.Throwable; failed to set access: java.lang.IllegalAccessException: Reflection is not allowed on private java.lang.Throwable java.lang.Throwable.cause
at com.fasterxml.jackson.databind.util.ClassUtil.checkAndFixAccess(ClassUtil.java:505)
at com.fasterxml.jackson.databind.introspect.AnnotatedMember.fixAccess(AnnotatedMember.java:123)
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.constructSettableProperty(BeanDeserializerFactory.java:704)
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.addBeanProps(BeanDeserializerFactory.java:501)
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildThrowableDeserializer(BeanDeserializerFactory.java:356)
at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:114)
I tried preventing this by using @JsonIgnoreProperties
:
@JsonIgnoreProperties("cause")
public class MyException extends RuntimeException { ... }
... but the same error still occurs. What am I doing wrong? What else could I do?
I've also considered setting MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS
to false, but I don't like this solution because I need this setting to be true
in some other cases (in particular, I provide no-arg constructors for Jackson, but they should't be public in my API).
Metadata
Metadata
Assignees
Labels
No labels