title: Can Java object class implements Serializable and has Jackson annotation same time?
body: <p>I developed the below rest api controller and request DTO</p>
  <p>DTO class:</p>
  <pre><code>@JsonIgnoreProperties(ignoreUnknown = true)
  public class reqDto implements Serializable{
      
      @NotNull(message=&quot;STATUS cannot be null&quot;)
      @Pattern(regexp = &quot;^can$&quot;)
      private String status;
  
      @Pattern(regexp = &quot;^\\d{6}$|^$&quot;)
      private String rgstrn;
  }
  </code></pre>
  <p>Controller class:</p>
  <pre><code>@Path(&quot;/foo&quot;)
  public class controller {
  
      private static Logger log = Logger.getLogger(controller.class);
  
      private static final long serialVersionUID = 1L;
  
      @Inject
      private Service Service;
  
      
      @POST
      @Consumes(MediaType.APPLICATION_JSON)
      @Produces(MediaType.APPLICATION_JSON)
      @Path(&quot;/foo/bar&quot;)
      public Response foo(reqDto reqDto) throws WebApplicationException {
  
          Response resp = null;
  
          // validate request dto bean constraints and get error message
          List&lt;String&gt; errMsgs=Validator.validateConstraintViolation(reqDto);
  
          RespDto resultDto = new RespDto();
          
          // if req dto not validated, return 400
          if (errMsgs.size() &gt; 0) {
              resultDto.setErrorMsg(&quot;400&quot;, BAD_REQUEST_400, errMsgs);
              resp = Response.status(Integer.parseInt(resultDto.getHttpCode())).entity(resultDto).build();
  
          } else {
          // call service 
              resultDto = Service.createCase(reqDto);
              
              resultDto.setErrorMsg(&quot;200&quot;, CREATED_201);
              
              resp = Response.status(Integer.parseInt(resultDto.getHttpCode())).entity(resultDto).build();
              
          }
  
          return resp;
      }
  </code></pre>
  <p>when my reqDto implements Serializable, I got exception NullPointerException from my filter class</p>
  <p>when my reqDto does not implement Serializable, I got exception</p>
  <pre><code>Validator - Invalid request: com.reqDto, constraint violations: [ConstraintViolationImpl{rootBean=com.reqDto@24f5f4ad, propertyPath='status', message='STATUS cannot be null', leafBean=com.reqDto@24f5f4ad, value=null}]
  </code></pre>
  <p>when my filter shows payload is <code>{ &quot;status&quot;: &quot;can&quot;, &quot;rgstrn&quot;: &quot;123456&quot; }</code></p>