Skip to content
Advertisement

IllegalAnnotationException: Two classes have the same XML type name

I am developing web service under JBoss 5 and Java 1.6. What could possibly cause this exception? Below is my simplified web service code.

JavaScript

And below is the full stack trace.

JavaScript

Advertisement

Answer

I found the cause of my problem.

This problem occurs because JAX-WS generates a class for each method and the class name is constructed by concatenating methodName + "Response". In my case, the newly generated class by JAX-WS will have the same name as my response object.

Example:

JavaScript

JAX-WS will generate a new class CreateAccountResponse for Web Method createAccount which has the same name as the response object.

Solution:

Make sure that the name of the response object and method doesn’t match. The same thing applies to the method parameter as well.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement