title: IllegalAnnotationsException: Class has two properties of same name
body: <p>I am trying to develop a IBM JAX_WS web service using RSA 7.5 and Websphere 7 server. Since I am a beginner, hence I am following Java-class first approach i.e. I am creating the Java classes first and then generating the WSDL file.</p>
  
  <p>When i try to create the wsdl file, i am getting an exception:</p>
  
  <p><strong>java.security.PrivilegedActionException:com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationsException
  Class has two properties of the same name "planId"</strong></p>
  
  <p>My class refered here looks something like this:</p>
  
  <pre><code>public class MemberDetails{
      @XMLElement(required=true)
      private String planId;
      //public getters and setters for the planId;
  }
  </code></pre>
  
  <p>I dont have any idea like why is this exception happening. Via Google search I tried a few alternatives to resolve it but none of them worked for me :(</p>
  
  <p><strong>Note:</strong></p>
  
  <p>This is the only annotation I am using throughout my workspace. I am not sure if this is dependent on some other annotations or not. But I tried with a few such as @XMLElement(name="Plan",required=true), @XMLType, etc but every time I am getting this exception.</p>
  
  <p>This exception is occuring during wsgen. (<strong>java.lang.reflect.InvocationTargetException</strong>)</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Basically, when we create a wsdl from java service method and open that WSDL in SOAP UI, then we get <code>&lt;!--Optional--&gt;</code> at the top of every element. I want to remove this option tag <code>&lt;!--Optional--&gt;</code> tag, hence I am trying for @XMLElement(required=true) approach so that when I open the WSDL in SOAP UI <code>&lt;!--Optional--&gt;</code> does not appears for compulsary elements. </p>
  
  <p>According to my concept, @XMLElement(required=true) will set the minOccurs to 1 i.e. greater than zero and hence the optional comment will be removed from WSDL when I open it in SOAP UI. But Unfortunately its not working hence my concept is incorrect. After the WSDL is generated, I can see that the minOccurs is still 0. </p>
  
  <p>Please explain how can I remove the optional tag when I open the WSDL in SOAP UI. </p>
  
  <p>Regards,</p>