Reference to my previous post. I have following code which is reading XML from the file.
logger.log(Level.INFO, \"testSchemaChange\");
JAXBContext jaxbContext =
The problem you are seeing is because the JAXBContext
isn't aware of your ObjectFactory
class that contains the @XmlElementDecl
annotation for the book
element.
When you create a JAXBContext
on a package name, the it will automatically pull in the ObjectFactory
class. If you create a JAXContext
on classes you need to explicitly include the class with the @XmlRegistry
annotation (ObjectFactory
in this case).