I have a class as
@XmlRootElement(name="Helloworld")
@XmlType(propOrder = { "userName"})
public class UserDetails {
//User Name
@XmlElement(name="UserName")
private String userName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
I am getting run time exception as
There are two properties named "userName" ...
Can any tell the mistake in above class.
It is because you have getter and setter and annotation on the field. You could fix it by moving annotation from field property to getter method.