title: java.lang.AssertionError: Cannot construct instance of java.lang.Enum
body: <p>I am developing a client/server application, that in the backend has some REST methods developed with RESTeasy. </p>
  
  <p>Particularly, there is a <strong>POST</strong> method that, as input, takes a JSON string, and then returns another JSON to the calling client.</p>
  
  <p>The conversion from JSON to a Java class is performed by Jackson in a transparent way, but I have this problem: </p>
  
  <blockquote>
    <p>java.lang.AssertionError: Can not construct instance of java.lang.Enum, problem: abstract types can only be instantiated with additional type information</p>
  </blockquote>
  
  <p>The JUnit Test that fails with this error is:</p>
  
  <pre><code>/**
   * Test for creation of json of {@link FindRequestBody}.
   */
  @Test
  public void testJackson2(){
      try {
          FindRequestBody findRequestBody = new FindRequestBody();        
  
          ObjectMapper jacksonMapper = new ObjectMapper();
          ObjectMapper mapper = new ObjectMapper();
  
          File file = new File("c:\\testFindRequestBody.json");
          jacksonMapper.writeValue(file, findRequestBody);
  
          Path path = Paths.get("c:\\testFindRequestBody.json");
          byte[] data = Files.readAllBytes(path);
  
          FindRequestBody returned = jacksonMapper.readValue(data, FindRequestBody.class);
  
          Assert.assertNotNull(returned);
  
      } 
      catch (JsonGenerationException e) {
          e.printStackTrace();
          Assert.fail(e.getMessage());
      } 
      catch (JsonMappingException e) {
          e.printStackTrace();
          Assert.fail(e.getMessage());
      } 
      catch (IOException e) {
          e.printStackTrace();
          Assert.fail(e.getMessage());
      } 
  </code></pre>
  
  <p>The REST method is:</p>
  
  <pre><code> /**
   * {@inheritDoc}
   */
  @POST
  @Path("/filter")
  @Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  @Override
  public List&lt;Object&gt; find(FindRequestBody findRequestBody){
      return service.find(findRequestBody);
  }
  </code></pre>
  
  <p>The <code>JSON</code> taken as input from the method is, for example:</p>
  
  <pre><code>{     
     "orderReadContext":{  
        "valid":"VALID_ONLY"
     },
     "queryControl":{  
        "firstResult":0,
        "maxResults":-1,
        "sortOrder":[      
        ]
     }
  }
  </code></pre>
  
  <p>The field valid is a field that maps an <code>Enum</code>. The FieldRequestBody class contains the OrderReadContext class that is:</p>
  
  <pre><code>public class OrderReadContext implements Serializable
  {
      protected ValidOrAll valid = ValidOrAll.VALID_ONLY;
  
      public ValidOrAll getValid()
      {
          return this.valid;
      }
  
     public void setValid(ValidOrAll arg)
     {
          if (arg == null)
          {
              this.valid = ValidOrAll.VALID_ONLY;
          }
          else
          {
              this.valid = arg;
           }
      }
  }
  </code></pre>
  
  <p>Probably caused by the fact that, in the Java class corresponding to the JSON, there are some fields that are <code>Enum</code>.</p>
  
  <p>I cannot use annotations, so I want to know if it is possible to use some Providers, or Interceptors, etc.</p>