Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use a jaxb.index file?

Tags:

jaxb

I'm getting

javax.xml.bind.JAXBException: "org.example.mypackage" doesnt contain ObjectFactory.class or jaxb.index 

while trying to create a JAXBContext using JAXBContext.newInstance(String contextPath). I'm guessing there's a "usual" way to create and maintain a jaxb.index file.

like image 258
loosenut Avatar asked May 22 '09 19:05

loosenut


People also ask

What is the JAXB index file?

The jaxb. index file is just a listing of the classes in the containing package that have JAXB annotations. Each line in the file is a class's simple name, not its fully qualified name.

What is ObjectFactory in JAXB?

jaxb package. An ObjectFactory allows you to programatically construct new instances of the Java representation for XML content. The Java representation of XML content can consist of schema derived interfaces and classes representing the binding of schema type definitions, element declarations and model groups.


1 Answers

The jaxb.index file is just a listing of the classes in the containing package that have JAXB annotations.

Each line in the file is a class's simple name, not its fully qualified name.

You can read more here: http://cmaki.blogspot.com/2007/09/annotated-jaxb-classes.html

like image 186
Rafael M Avatar answered Oct 10 '22 03:10

Rafael M