IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions

Error:


Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://.../}YourClass". Use @XmlType.name and @XmlType.namespace
to assign different names to them.
   this problem is related to the following location:



Cause:

A probable reason is that you might be having two Java classes which you are trying to expose through the webservice. That's why the JAX-WS is confused with this and popping out the exception.

Solution:

Using the XmlType annotation can rescue you from this odd situation. Just use the annotation at the top of your java class and give a different name through the name attribute. For example:

@XmlType(name="newClassName")


Comments