title: Spring + JAXB integration : Class has two properties of the same name
body: <p>I am facing problem in <strong>generating WSDL</strong>. I want to create <strong>SOAP web service</strong> which generate <strong>json string</strong>. Below pojo classes are referenced from another web project into my web service project. I write generated json string on <strong>servlet response</strong> object which is created by using <strong>WebServiceContext</strong> &amp; it is annotated with @Resource annotation.</p>
  
  <p>I also tried to <strong>debug</strong> web service method (parameterized annotated with @WebParam), pojo but project is not starting in debug mode. Before calling web method it <strong>throws exception</strong> for all fields : </p>
  
  <pre><code>Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 15 counts of IllegalAnnotationExceptions
  Class has two properties of the same name "result"
  this problem is related to the following location:
      at public portal.common.ejb.LoginResult portal.common.ejb.LoginResponse.getResult()
      at portal.common.ejb.LoginResponse
  this problem is related to the following location:
      at private portal.common.ejb.LoginResult portal.common.ejb.LoginResponse.result
      at portal.common.ejb.LoginResponse
  Class has two properties of the same name "userInfo"
  this problem is related to the following location:
      at public portal.common.ejb.UserDTO portal.common.ejb.LoginResponse.getUserInfo()
      at portal.common.ejb.LoginResponse
  this problem is related to the following location:
      at private portal.common.ejb.UserDTO portal.common.ejb.LoginResponse.userInfo
      at portal.common.ejb.LoginResponse
  Class has two properties of the same name "notifications"
  this problem is related to the following location:
      at public java.util.List portal.common.ejb.LoginResult.getNotifications()
      at portal.common.ejb.LoginResult
      at private portal.common.ejb.LoginResult portal.common.ejb.LoginResponse.result
      at portal.common.ejb.LoginResponse
  this problem is related to the following location:
      at private java.util.List portal.common.ejb.LoginResult.notifications
      at portal.common.ejb.LoginResult
  ...
  </code></pre>
  
  <p>I am using <strong>jaxws-ri-2.2.8</strong>, <strong>jaxws-json-1.2</strong>, <strong>jaxws-spring-1.9</strong>, <strong>xbean-spring-3.9</strong> &amp; <strong>spring-framework-4.0.3.RELEASE-dist</strong>.</p>
  
  <p><strong>NOTE :</strong> I am not much familiar with web services, so please be polite &amp; patient.</p>
  
  <p><strong>POJO</strong></p>
  
  <pre><code>@XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class LoginResponse {
  
      private LoginResult result;
      private UserDTO     userInfo;
      // Getter/setter
  }
  
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class LoginResult {
  
      private List&lt;String&gt;    notifications;
      private boolean         success;
      // Getter/setter
  }
  
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class UserDTO {
  
      private String  eMail;
      private Integer externalIdentifier;
      private String  firstName;
      private String  lastLoggedIn;
      private String  lastName;
      private String  phone;
      private Integer role;
      private String  status;
      private String  title;
      private int     userId;
      private String  userIdentifier;
  
      // Getter/setter
  }
  </code></pre>
  
  <p><strong>Refered Doc:</strong></p>
  
  <p>I also refer below link to solve the error</p>
  
  <p><a href="http://blog.bdoughan.com/2011/06/using-jaxbs-xmlaccessortype-to.html" rel="nofollow noreferrer">JAXB's @XmlAccessorType - @Blaise Doughan </a></p>
  
  <p><a href="https://stackoverflow.com/questions/6768544/jaxb-class-has-two-properties-of-the-same-name">Jaxb, Class has two properties of the same name - Stackoverflow</a></p>
  
  <p><a href="https://stackoverflow.com/questions/12392235/illegalannotationsexception-class-has-two-properties-of-same-name">IllegalAnnotationsException: Class has two properties of same name - Stackoverflow</a> , etc.</p>
  
  <p>I tried all examples given by @Blaise Doughan. All works fine in Java application &amp; Web app too. Also tried to generate wsdl &amp; it generated &amp; print output xml on console.</p>
  
  <p><strong>Can anybody point out what's wrong in my pojo classes ?  I spend so much time on this but no luck. What should I have to do to get off this error ?</strong></p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>I also <strong>tried @XmlTransient</strong> annotation on getter method &amp; <strong>@XmlElement</strong> annotation on all fields but, same issue.</p>
  
  <p>Thanks a lot</p>