title: JAXB : 2 counts of IllegalAnnotationExceptions
body: <p>This is my Parser class</p>
  <pre><code>public class Test {
      public static void main(String args[]) throws Exception {
  
          File file = new File(&quot;D:\\Test.xml&quot;);
          JAXBContext jaxbContext = JAXBContext.newInstance(MyOrder.class);
          Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
          MyOrder customer = (MyOrder) jaxbUnmarshaller.unmarshal(file);
          System.out.println(customer.getOrder().getSide());
      }
  }
  </code></pre>
  <p>This is MyOrder.java file</p>
  <pre><code>@XmlRootElement(name = &quot;BXML&quot;)
  public class MyOrder {
      @XmlElement(name = &quot;Bag&quot;)
      protected Order order;
  
      public MyOrder() {
  
      }
      @XmlAttribute
      public Order getOrder() {
          return order;
      }
      public void setOrder(Order order) {
          this.order = order;
      }
  }
  </code></pre>
  <p>This is my Domain Object (Order.java )</p>
  <pre><code>@XmlRootElement(name = &quot;BXML&quot;)
  public class Order {
  
      public Order() {
  
      }
  
      @XmlAttribute(name = &quot;Side&quot;)
      protected BigInteger Side;
  
      @XmlValue
      public BigInteger getSide() {
          return Side;
      }
  
      public void setSide(BigInteger side) {
          Side = side;
      }
  }
  </code></pre>
  <p>This is the exception that I am getting when I tried to run the program</p>
  <pre><code>Exception in thread &quot;main&quot; com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
  @XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML.
      this problem is related to the following location:
          at public com.Order com.MyOrder.getOrder()
          at com.MyOrder
  Class has two properties of the same name &quot;order&quot;
      this problem is related to the following location:
          at public com.Order com.MyOrder.getOrder()
          at com.MyOrder
      this problem is related to the following location:
          at protected com.Order com.MyOrder.order
          at com.MyOrder
  </code></pre>