title: jersey return 500 when trying return an XML
body: <p>I have a problem with using Jersey 2.29. Its simple example. I managed to return text-plain, but if I trying return XML i get 500 error.</p>
  
  <p>My steps: </p>
  
  <p>Start server. Go to <code>http://localhost:8080/demorest/webapi/aliens</code>. I 
  I'll get 500.</p>
  
  <p>when I rewrote this example to return text-plain, everything was ok. But with XML is a problem.</p>
  
  <p>I looked here:
  <a href="https://stackoverflow.com/questions/26014184/jersey-returns-500-when-trying-to-return-an-xml-response">Jersey returns 500 when trying to return an XML response</a>
  But its not work to me.</p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!-- This web.xml file is not required when using Servlet 3.0 container,
       see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html --&gt;
  &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
      &lt;servlet&gt;
          &lt;servlet-name&gt;Jersey Web Application&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.glassfish.jersey.servlet.ServletContainer&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;jersey.config.server.provider.packages&lt;/param-name&gt;
              &lt;param-value&gt;com.test.demorest&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 Web Application&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/webapi/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  &lt;/web-app&gt;
  
  </code></pre>
  
  <p>Alien.java</p>
  
  <pre><code>package com.test.demorest;
  
  import javax.xml.bind.annotation.XmlRootElement;
  
  @XmlRootElement
  public class Alien {
  
      private String name;
      private int points;
  
      public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
      public int getPoints() {
          return points;
      }
      public void setPoints(int points) {
          this.points = points;
      }
  
  }
  </code></pre>
  
  <p>AlienResource.java</p>
  
  <pre><code>package com.test.demorest;
  
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.MediaType;
  
  
  @Path("aliens")
  public class AlienResource {
  
      @GET
      @Produces(MediaType.APPLICATION_XML)
      public Alien getAlien() {
          System.out.println("getAlien called...");
          Alien a1 = new Alien();
          a1.setName("Adam");
          a1.setPoints(23);
  
          return a1;
      }
  
  }
  
  </code></pre>