Search This Blog

Saturday, November 22, 2014

IllegalAnnotationsException NameConverter

IllegalAnnotationsException

Problem :

com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
com.sun.xml.bind.api.impl.NameConverter is an interface, and JAXB can't handle interfaces


Reason : 

This exception is usually seen when you have two elements with the same name. However, if you have corrected this by changing the similar element definitions as a new complexType then the issue is not because of your code but this is because of an issue in JAXB version 2.2.7.

 

Solution : 

The solution is to provide the jaxb-impl.jar to the command that creates the java classes from XSD. For example,

xjc.bat -b Employee.xsd

should be changed to 

xjc.bat -cp ../lib/jaxb-impl.jar -b Employee.xsd

No comments: