title: JAXB Error "The system cannot marshal the <pojo > JAXB object into XML content. Verify that the JAXB object is valid"
body: <p>I am using MobileFirst platform Foundation 7.0.</p>
  
  <p>I created a "Test" Java adapter that provides a REST API and returns a JAXB annotated Object.</p>
  
  <p>When I test the api with JSON format it is working fine, but when I change the content type to application/xml I get "500 internal exception" error and in the console i see the following exception:</p>
  
  <blockquote>
    <p>The system cannot marshal the model.UserManager JAXB object into XML
    content. Verify that the JAXB object is valid.</p>
  </blockquote>
  
  <p>This is my User and UserManager POJOs:</p>
  
  <pre><code>@XmlRootElement(name="newuser")
  @XmlAccessorType(XmlAccessType.NONE)
  public class UserNew {
  
      @XmlElement
      String id;
  
      @XmlElement
      String name;
  
      @XmlElement
      String email;
  
      @XmlElement
      String password;
  
  
      public UserNew(String id, String name, String email, String password) {
          super();
          this.id = id;
          this.name = name;
          this.email = email;
          this.password = password;
      }
  
      // getter ,setter equals and hashCode follows.
  </code></pre>
  
  <p>This is UserManager:</p>
  
  <pre><code>@XmlRootElement
  public class UserManager {
  
      @XmlElement
      String managerId;
      @XmlElementWrapper(name="users")
      ArrayList&lt;UserNew&gt; users;
      public UserManager(String managerId, ArrayList&lt;UserNew&gt; users) {
          super();
          this.managerId = managerId;
          this.users = users;
      }
  
      // getter ,setter equals and hashCode follows.
  </code></pre>
  
  <p>This is my REST API method in the Java adapter:</p>
  
  <pre><code>@GET
  @Path("/getUser")
  @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XHTML_XML})
  public UserManager getUser(){
      UserNew user1 =  new UserNew("101","user1","user1@gmail.com","password!");
      UserNew user2 =  new UserNew("102","user2","user2@gmail.com","password!");
      ArrayList&lt;UserNew&gt; userList = new ArrayList&lt;&gt;();
      userList.add(user2);
      userList.add(user1);
  
      return new UserManager("manager10101",userList);
  }
  </code></pre>