title: MessageBodyWriter not found for media type={application/xml, q=1000} - Jersey + Jaxb
body: <p>I am writing a RESTful web service with Jersey. I want to return a custom object in XML form to consumer. The error I am getting is: </p>
  
  <blockquote>
    <p>MessageBodyWriter not found for media type={application/xml, q=1000}, type=class com.test.ws.Employee, genericType=class com.test.ws.Employee. </p>
  </blockquote>
  
  <p>Below is the code:</p>
  
  <p><strong>web.xml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://java.sun.com/xml/ns/javaee"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  id="WebApp_ID" version="3.0"&gt;
  &lt;display-name&gt;com.vogella.jersey.first&lt;/display-name&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
      &lt;!-- Register resources and providers under com.vogella.jersey.first package. --&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
          &lt;param-value&gt;com.test.ws&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;Jersey REST Service&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;/web-app&gt; 
  </code></pre>
  
  <p><strong>Service Class</strong></p>
  
  <pre><code>package com.test.ws;
  
  @Path("/hello")
  public class Hello {
  
      @GET 
      @Path("/sayHello")
      @Produces(MediaType.APPLICATION_XML)
      public Employee sayHello() {
          Employee employee = new Employee();
          employee.setEmpId(1);
          employee.setFirstName("Aniket");
          employee.setLastName("Khadke");
          return employee;
      }
  }
  </code></pre>
  
  <p><strong>Employee.java</strong></p>
  
  <pre><code>package com.test.ws;
  
  import javax.xml.bind.annotation.XmlElement;
  import javax.xml.bind.annotation.XmlRootElement;
  
  @XmlRootElement(name = "employee")
  public class Employee {
  
      public String firstName;
  
      public String lastName;
      public int empId;
  
      public Employee(String firstName, String lastName, int empId) {
          super();
          this.firstName = firstName;
          this.lastName = lastName;
          this.empId = empId;
      }
  
      public Employee() {
          super();
      }
  
      @XmlElement
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      @XmlElement
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
      @XmlElement
      public int getEmpId() {
          return empId;
      }
  
      public void setEmpId(int empId) {
          this.empId = empId;
      }
  
  }
  </code></pre>
  
  <p>And here is the list of libraries added:</p>
  
  <p><img src="https://i.stack.imgur.com/AwHM5.jpg" alt="Jars">
  <br/><br/></p>
  
  <p>Can anyone help me?</p>