RESTEASY008200: JSON Binding deserialization error: No default constructor
See original GitHub issueDescribe the bug I get the error described in https://github.com/quarkusio/quarkus/issues/3179. The issue was closed as it should be resolved with quarkus 1.0 Final and its dependency yasson 1.0.5. But error is still there. I cannot add a no args constructor because the class is defined within an external dependency (library).
javax.ws.rs.ProcessingException: RESTEASY008200:
JSON Binding deserialization error: javax.json.bind.JsonbException: Can't create instance of a class: class com.domain.Task, No default constructor found.
at org.jboss.resteasy.plugins.providers.jsonb.JsonBindingProvider.readFrom(JsonBindingProvider.java:78)
at org.jboss.resteasy.core.interception.jaxrs.AbstractReaderInterceptorContext.readFrom(AbstractReaderInterceptorContext.java:102)
at org.jboss.resteasy.core.interception.jaxrs.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:81)
at org.jboss.resteasy.client.jaxrs.internal.ClientResponse.readFrom(ClientResponse.java:226)
at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:88)
at org.jboss.resteasy.specimpl.AbstractBuiltResponse.readEntity(AbstractBuiltResponse.java:270)
...
Caused by: javax.json.bind.JsonbException: Can't create instance of a class: class com.domain.Task, No default constructor found.
at org.eclipse.yasson.internal.serializer.ObjectDeserializer.getInstance(ObjectDeserializer.java:95)
at org.eclipse.yasson.internal.serializer.AbstractContainerDeserializer.deserialize(AbstractContainerDeserializer.java:61)
at org.eclipse.yasson.internal.serializer.CollectionDeserializer.deserializeNext(CollectionDeserializer.java:106)
at org.eclipse.yasson.internal.serializer.AbstractContainerDeserializer.deserializeInternal(AbstractContainerDeserializer.java:84)
at org.eclipse.yasson.internal.serializer.AbstractContainerDeserializer.deserialize(AbstractContainerDeserializer.java:60)
at org.eclipse.yasson.internal.Unmarshaller.deserializeItem(Unmarshaller.java:68)
at org.eclipse.yasson.internal.Unmarshaller.deserialize(Unmarshaller.java:54)
at org.eclipse.yasson.internal.JsonBinding.deserialize(JsonBinding.java:53)
at org.eclipse.yasson.internal.JsonBinding.fromJson(JsonBinding.java:93)
at org.jboss.resteasy.plugins.providers.jsonb.JsonBindingProvider.readFrom(JsonBindingProvider.java:70)
... 48 more
There must be a bug somewhere in Yasson, RESTEasy or Quarkus. The method execution works in wildfly but not in quarkus. Maybe yasson or something else cannot add a default constructor in quarkus at runtime if one is missing (by reflection).
Environment (please complete the following information):
- Output of
java -version
: 12 - Quarkus version or git rev: 1.0 Final
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
JSON binding deserialization error resolving runtime type
I am trying to make a restful API pick up the right class when provided a JSON object. Consider the ...
Read more >WF14 throwing RESTEASY008200 - JBoss.org
ProcessingException: RESTEASY008200: JSON Binding deserialization error at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.
Read more >JsonbException: Cannot create instance of a class - Yawin Tutor
The javax.json.bind.JsonbException: Cannot create instance of a class: class, No default constructor found. exception occurs when no default ...
Read more >Intro to the JSON Binding API (JSR 367) in Java - Baeldung
A quick and practical introduction to the new JSON Binding API in Java. ... For a long time, there was no standard for...
Read more >StackOverflowError when executing Hibernate Panache list ...
Hi Quarkus devs, I've stumbled upon a "RESTEASY008205: JSON Binding serialization error java.lang.StackOverflowError" when executing a REST GET backed by an ...
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 Free
Top 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
Can you please try using the
resteasy-jackson
dependency instead ofresteasy-jsonb
?The json annotations that you are using seem to be Jackson annotations, not JSON-B annotations.
@gsmet With default-constructor you mean a “no-arg-constructor”. I cannot add this - the class is within a library only included in my
pom.xml.
and secondly, such a class (with final fields) cannot have ano-arg-constructor
.The error:
is misleading because quarkus uses falsely json-b instead of jackson and this is the reason why it is not working. The library which includes
Task.class
explicitly declares jackson and not json-b…however quarkus ignores this. Using@JsonCreator
eliminates the need of an empty default constructor in jackson by definition. However, quarkus ignores this and wants a default constructor even if no such constructor is needed because the class uses@JsonCreator
.As I described above: the origin error which lead to this error is hard to trace and not shown in this error log because it is indirectly caused by the fact I described above.
So the only reason why this works in wildfly (even without adding a no-arg-constructor) is that it has a modular class loader (jboss modules). Am I right?