-
Hello All, I'm using stock WildFly Full 27.0.1.Final with included RESTEasy version 6.2.1.Final and default configuration. I'm experiencing an issue where the JSON generated on methods that return a Response containing a single object T differs from the JSON produced on methods that return a Response containing a List<T>. In one case, T is abstract and requires polymorphic type handling. The serialization on the List method honors the @JsonbTypeInfo and @JsonbSubtype annotations, whereas the single item method does not. There are no other annotations on the classes. For Example:
I've discovered that (in my case) RESTEasy is using org.eclipse.persistence.jaxb.rs.MOXyJsonProvider to serialize the single object response and org.eclipse.yasson to serialize the list/array response. Any idea why it would do this, and how can I prevent it from using MOXy? I tried adding org.eclipse.persistence.jaxb.rs.MOXyJsonProvider to the Wildfly JAXRS configuration 'Resteasy Disable Providers' list, but no luck. POM dependencies
Note: I created a sample project without org.eclipse.persistence in the POM and don't see the same behavior. I'm assuming the MOXy provider embedded in eclipselink is coming into play. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Is there a reason you're using EclipseLink rather than Hibernate? In WildFly Hibernate is the default Jakarta Persistence implementation. Maybe you could try excluding the |
Beta Was this translation helpful? Give feedback.
I wasn't able to get the deployment descriptor to make a difference (assuming I defined it correctly, which is a stretch e.g., I referenced the eclipselink jar in resource-root path as I found the MOXy Provider is embedded directly in the jar.
However
I was finally able to work around this issue by removing EclipseLink from my pom and adding it directly to my Wildfly instance for general availability. In hindsight, maybe that's what I was supposed to do on Wildfly, rather than packaging it with the war?
For anyone out there hitting the same issue (or other inconsistent JSON serialization), here is what I did:
Remove EclipseLink from your project. For Maven, remove it from your POM or se…