File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes The attribute required is undefined for the annotation type XmlElementRef Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "The attribute required is undefined for the annotation type XmlElementRef" Watch "The attribute required is undefined for the annotation type XmlElementRef" New topic
Author

The attribute required is undefined for the annotation type XmlElementRef

David Brossard
Ranch Hand

Joined: Jun 03, 2004
Posts: 109
I had this error this morning and although googling did help me understand the cause, it didn't help me figure out the solution.

I have finally resolved it and figured I would share it for future reference.

This is an error due to JAXB. More specifically, this is due to the fact that 2 versions of JAXB are being used. In my case I took a WSDL and generated a client stub using Metro 2.0.1. It so happens that Metro 2.0.1 includes JAXB 2.2.1. My client was therefore generated using JAXB 2.2.1.

That said, the JDK 1.6 now comes with JAXB too, but a slightly older version (2.1.1 I believe) which leads to the following error message in your favorite IDE:
The attribute required is undefined for the annotation type XmlElementRef

The only way to solve it was to change the order of my build class path in Eclipse and to put the Metro libs before the JDK libs.

Did anyone find any other way?

Cheers,
David.


No matter what they say in Ohio, we're still first in flight!
Bogdan Baraila
Ranch Hand

Joined: May 23, 2011
Posts: 43
You can put the jaxb_api.jar from the jaxb version that you're using in the ..Java\jre6\lib\endorsed directory. If the endorsed folder doesn't exist in your java lib you need to create it.
szymon blaskowski
Greenhorn

Joined: Oct 19, 2012
Posts: 1
it can be automated as:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The attribute required is undefined for the annotation type XmlElementRef