title: Arraylist implementation
body: <p>I have a class Researcher, and an ArrayList named researcherList that contains a list of researchers.<br>
  I want to get all researchers information from the database and put it in the researcherlist ArrayList that I created, and my response to client will be list of researchers. I have written the code below please try to see the code and find the bug. It is not working. It creates an exception. Here is the exception</p>
  
  <pre><code>SEVERE: A message body writer for Java type, class java.util.ArrayList, and MIME media type, application/xml, was not found
  SEVERE: Mapped exception to response: 500 (Internal Server Error) javax.ws.rs.WebApplicationException
  </code></pre>
  
  <hr>
  
  <pre><code>@GET
  @Path("/researcher/all")
  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
  public Response getAllResearchers() {
  
      //TODO return proper representation object
  
      Researcher res = new Researcher();
      List&lt;Researcher&gt; researcherList = new ArrayList&lt;Researcher&gt;();
      try {
          ResultSet resList = researcher.getAllResearcher();
  
          while (resList.next()) {
              res.setId(resList.getInt("id"));
              res.setResearcherName(resList.getString("name"));
              res.setAge(resList.getInt("age"));
              res.setSex(resList.getString("sex"));
              res.setCity(resList.getString("city"));
              res.setStreet(resList.getString("street"));
              res.setTelephone(resList.getString("telephone"));
              researcherList.add(res);
          }
      } catch (SQLException ex) {
          ex.printStackTrace();
      }
  
      return Response.ok(researcherList).build();
  }
  </code></pre>