File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The attribute required is undefined for the annotation type XmlElementRef

 
David Brossard
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bogdan Baraila
Ranch Hand
Posts: 43
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it can be automated as:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic