title: RESTEasy can't find Message Body Writer for application/xml when using dynamically created class
body: <blockquote>
    <p>Could not find MessageBodyWriter for response object of type: java.util.ArrayList of media type: application/xml</p>
  </blockquote>
  
  <p>I am getting the above error when trying to return a response in xml of a list of dynamically created classes/dtos.</p>
  
  <pre><code>@GET
  @Path("objects")
  public Response getObjects(
          @DefaultValue("json") @QueryParam("format") String format)
  {    
       GenericEntity entity;
  
       //I use cglib here to dynamically at runtime create a class called objectDto.
       //The class is just a POJO.
  
       List&lt;Object&gt; objectsDto = generateObjects(fields);
  
       entity = new GenericEntity&lt;List&lt;Object&gt;&gt;(objectsDto){};
  
       Response.ResponseBuilder rBuild;
  
      if (format.equals("xml"))
      {
          rBuild = Response.ok(entity, MediaType.APPLICATION_XML);
      }
      else
      {
          rBuild = Response.ok(entity, MediaType.APPLICATION_JSON);
      }
  
      return rBuild.build();
  }
  </code></pre>
  
  <p>The weird thing is I can return JSON representations of this object but not XML. Also I can return XML representations of not dynamically created classes.</p>
  
  <p>I have the correct dependency in my Maven project for resteasy-jaxb-provider:</p>
  
  <pre><code>&lt;dependency&gt;
          &lt;groupId&gt;org.jboss.resteasy&lt;/groupId&gt;
          &lt;artifactId&gt;resteasy-jaxb-provider&lt;/artifactId&gt;
          &lt;version&gt;3.0.6.Final&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>