title: Etat HTTP 415 - Unsupported Media Type : GET not reaching Jersey REST
body: <p>I'm using Spring MVC with hibernate. I have a RESTful web service, written using Jersey, that looks like this:</p>
  
  <pre><code> @GET  
    @Path("/interets/{idCentre}/annonces") 
    @Produces(MediaType.APPLICATION_JSON)
    public List&lt;Annonce&gt; getAnnonceParCentre(@PathParam(value="idCentre") int idCentre){
        return metier.getAnnonceParCentre(idCentre);
     }
  </code></pre>
  
  <p>This is my Annonce class:</p>
  
  <pre><code>package ma.ensa.model;
  import java.util.Date;
  public class Annonce implements java.io.Serializable {
  
  private Integer idAnnonce;
  private String libelleAnnonce;
  private double prixAnnonce;
  private Date dateAnnonce;
  private double positionX;
  private double positionY;
  private double positionZ;
  private int idCentre;
  private String description;
  private int idVille;
  private int idPersonne;
  private CentreInteret centreInteret;
  
  public Annonce() {
  }
  
  public Annonce(String libelleAnnonce, double prixAnnonce, Date dateAnnonce, double positionX, double positionY,
          double positionZ, int idCentre, String description, int idVille, int idPersonne, CentreInteret centreInteret) {
      this.libelleAnnonce = libelleAnnonce;
      this.prixAnnonce = prixAnnonce;
      this.dateAnnonce = dateAnnonce;
      this.positionX = positionX;
      this.positionY = positionY;
      this.positionZ = positionZ;
      this.idCentre = idCentre;
      this.description = description;
      this.idVille = idVille;
      this.idPersonne = idPersonne;
  }
  
  public Integer getIdAnnonce() {
      return this.idAnnonce;
  }
  
  public void setIdAnnonce(Integer idAnnonce) {
      this.idAnnonce = idAnnonce;
  }
  
  public String getLibelleAnnonce() {
      return this.libelleAnnonce;
  }
  
  public void setLibelleAnnonce(String libelleAnnonce) {
      this.libelleAnnonce = libelleAnnonce;
  }
  
  public double getPrixAnnonce() {
      return this.prixAnnonce;
  }
  
  public void setPrixAnnonce(double prixAnnonce) {
      this.prixAnnonce = prixAnnonce;
  }
  
  public Date getDateAnnonce() {
      return this.dateAnnonce;
  }
  
  public void setDateAnnonce(Date dateAnnonce) {
      this.dateAnnonce = dateAnnonce;
  }
  
  public double getPositionX() {
      return this.positionX;
  }
  
  public void setPositionX(double positionX) {
      this.positionX = positionX;
  }
  
  public double getPositionY() {
      return this.positionY;
  }
  
  public void setPositionY(double positionY) {
      this.positionY = positionY;
  }
  
  public double getPositionZ() {
      return this.positionZ;
  }
  
  public void setPositionZ(double positionZ) {
      this.positionZ = positionZ;
  }
  
  public int getIdCentre() {
      return this.idCentre;
  }
  
  public void setIdCentre(int idCentre) {
      this.idCentre = idCentre;
  }
  
  public String getDescription() {
      return this.description;
  }
  
  public void setDescription(String description) {
      this.description = description;
  }
  
  public int getIdVille() {
      return this.idVille;
  }
  
  public void setIdVille(int idVille) {
      this.idVille = idVille;
  }
  
  public int getIdPersonne() {
      return this.idPersonne;
  }
  
  public void setIdPersonne(int idPersonne) {
      this.idPersonne = idPersonne;
  }
  }
  }
  </code></pre>
  
  <p>Method in DaoAnnonce Class:</p>
  
  <pre><code>@Override
  public List&lt;Annonce&gt; getAnnonceParCentre(int id) {
      Session session = sessionFactory.openSession();
      Query qr = session.createQuery("from Annonce where idCentre=:id").setInteger("id",id);
      @SuppressWarnings("unchecked")
      List&lt;Annonce&gt; crs = qr.list();
      session.close();
      return crs;
  }
  </code></pre>
  
  <p>When I'm trying to do a  GET : <a href="http://localhost:8080/projet_stage_v1/rs/interets/2/annonces" rel="nofollow">http://localhost:8080/projet_stage_v1/rs/interets/2/annonces</a></p>
  
  <p><strong>root cause:</strong></p>
  
  <pre><code>    Grave: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
  java.io.EOFException: No content to map to Object due to end of input
  at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2766)
  at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2682)
  at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1308)
  at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419)
  at com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy.readFrom(JacksonProviderProxy.java:139)
  at com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:488)
  at com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:123)
  at com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:46)
  at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:153)
  at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:183)
  at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
  at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
  at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
  at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
  at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
  at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
  at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
  at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
  at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
  at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
  </code></pre>