I'm trying to change the Java JDK version for an existing application from Java 5 to Java 6 (update 38). The application uses some JAXB generated classes to marshal/unmarshal XML that we send/receive from a remote server. The XML conforms to a schema (.xsd) file.
This all used to work fine under Java 5 with a downloaded bundle of JAXB binaries in the classpath. I'm not sure what the version of the downloaded JAXB binaries was (this project was already here before me). If I just change the JDK version from Java 5 to Java 6 (update 38), then I get a few unit test failures that never happened before, such as:
[org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1: '2012-08-22T00:00:00-04:00' is not a valid value for 'date'.]
I thought I might be able to solve this by moving the Java 6 JDK to the head of the classpath, so it is found before the external JAXB binaries. That yielded compile-time errors, such as:
The attribute required is undefined for the annotation type XmlElementRef
This error was reported on one of my JAXB-generated classes (based on the .xsd file). The error was caused by this annotation line:
@XmlElementRef(name = "DealCalendarId", type = JAXBElement.class, required = false)
So, I'm not sure what I need to do next. I have a few ideas:
- Remove the downloaded JAXB binaries and rely only on the built-in JAXB support in Java 6 SE (but I seem to remember this not working on a project some time ago...)
- Replace the downloaded JAXB binaries with a newer version
- Replace the downloaded JAXB binaries with a newer version AND put the Java 6 JDK after them in the classpath
- Do one of the above and also regenerate all my JAXB classes that are based on the .xsd
Any suggestions?