Friday, August 5, 2011

IllegalAnnotationsException, Two classes have the same XML type name


Share at Facebook

While working on a project using EJB3, I was getting the following error.

Two classes have the same XML type name "...". Use @XmlType.name and @XmlType.namespace to assign different names to them.

There are several cases those can raise this error. For my cases it was the following error. I have a function like below.


public TestResponse test(TestRequest request){
}


Look the method name and the return type, parameters. Possibly EJB internally used to add 'Request' and 'Response' tag with the method test(). So it becomes testResponse(), testRequest(), which is similar to parameter and return type of my code.

To overcome the issue, I have changed the method name into testMethod(). And it solved the issue.




No comments: