[ACCEPTED]-How do I use a jaxb.index file?-jaxb

Accepted answer
Score: 38

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

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

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

Score: 15

Try this way,

JAXBContext context = JAXBContext.newInstance(new Class[] {your.package.Test.class});

Also, make sure that you added 2 the @XmlRootElement to the Test class.

class Test {
  private String ...;
  private int ......;

also make sure that 1 you are using java 1.5

Score: 4

Make sure you're passing the correct class 8 to the method. Assuming your XML root element 7 is XMLRoot, you would call it as:

JAXBContext context = JAXBContext.newInstance(XMLRoot.class);

Also 6 make sure that you're using the correct 5 version of the JAXB compiler (xjc) for the 4 version of Java you're running. JAXB-generated 3 classes from the old compiler won't work 2 properly with Java 6's JAXB, giving the 1 same error.

More Related questions