title: Http 204 error in REST web service (Jersey)
body: <p>I am using Jersey/Java to develop my REST services. I need to return an XML representation for my CarStore :</p>
  
  <pre><code> @XmlRootElement
  public class CarStore {
   private List&lt;Car&gt; cars;
  
   public List&lt;Car&gt; getCars() {
    return cars;
   }
   public void setCars(List&lt;Car&gt; cars) {
    this.cars = cars;
   }
  </code></pre>
  
  <p>Here is my Car object :</p>
  
  <pre><code>@XmlRootElement
  &gt; public class Car {
   private String carName;
   private Specs carSpecs;
   private Category carCategory;
   public String getCarName() {
    return carName;
   }
   public void setCarName(String carName) {
    this.carName = carName;
   }
   public Specs getCarSpecs() {
    return carSpecs;
   }
   public void setCarSpecs(Specs carSpecs) {
    this.carSpecs = carSpecs;
   }
   public Category getCarCategory() {
    return carCategory;
   }
   public void setCarCategory(Category carCategory) {
    this.carCategory = carCategory;
   }
  
  }
  </code></pre>
  
  <p>Specs and Category are enums like this :</p>
  
  <pre><code>    @XmlRootElement
  &gt; public enum Category {
  
   SEDANS, COMPACTS, WAGONS, HATCH_HYBRIDS, SUVS, CONVERTIBLES, COMPARABLE;
  }
  </code></pre>
  
  <p>My resource class is :</p>
  
  <pre><code>    @GET
   @Produces({MediaType.APPLICATION_XML})
   public CarStore getCars()
   {
      return CarStoreModel.instance.getAllCars();
   }
  </code></pre>
  
  <p>My jersey client is :</p>
  
  <pre><code>WebResource service = client.resource(getBaseURI());
  System.out.println(service.path("rest").path("cars").accept(
  MediaType.APPLICATION_XML).get(String.class));
  </code></pre>
  
  <p>I am getting Http 204 error on access alongwith client exception :</p>
  
  <blockquote>
    <p>com.sun.jersey.api.client.UniformInterfaceException</p>
  </blockquote>
  
  <p>Any ideas ? Thanks ! </p>
  
  <p>EDIT : I have yet not developed the model class...I just initialized some car objects as dummy data and put them in carstore. Showing all the classes here would be very clumsy.
  BTW, sorry for writing 204 Error..it is just that I am getting an Exception that led me think so.</p>