Payara5 + RestEasy 6.0.1 uses Yasson

221 views Asked by At

When we upgraded RestEasy to 6.0.1 on Payara 5, we noticed that Payara now uses Yasson to serialize and deserialize objects, resulting in all @JsonIgnore, @JsonProperty to be ignored. We have added the jersey.config.jsonFeature context-param as specified in the docs:

<context-param>
    <param-name>jersey.config.jsonFeature</param-name>
    <param-value>JacksonFeature</param-value>
</context-param>

Falling back to RestEasy to 3, 4 or 5, Payara 5 again starts using Jackson and all @Json annotations are honored again.

How does RestEasy decide the provider (Yasson vs Jackson) and how can one force Jackson in RestEasy 6.0.1 on Payara?

1

There are 1 answers

0
chrisl08 On

After spending a couple of days investigating this, the solution was to:

  1. Add jersey-media-json-jackson dependency to the POM:
  <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-jackson</artifactId>
      <version>2.26</version>
  </dependency>
  1. Register org.glassfish.jersey.jackson.JacksonFeature.class in your Application class like so:

    @ApplicationPath("services")
     public class ApplicationConfig extends Application {
    
     @Override
     public Set<Class<?>> getClasses() {
         Set<Class<?>> classes = new HashSet<Class<?>>();
         classes.add(org.glassfish.jersey.jackson.JacksonFeature.class);
         // add the rest of your classes here
         return classes;
     }   
     }