There are a few longstanding issues with the Sun/Oracle JAXB in Java 6/7:
- its fairly broken XPath implementation (see http://java.net/jira/browse/JAXB-459 and http://java.net/jira/browse/JAXB-874 ).
The xpath expressions are evaluated against the XML document as it was when first opened in docx4j. You can update the associated XML document once only, by passing true into getJAXBNodesViaXPath. Updating it again with current JAXB 2.1.x or 2.2.x) will cause an error.
- cases where getParent won't work (see http://java.net/projects/jaxb/lists/use ... message/20 )
Hopefully MOXy doesn't suffer from these deficiencies. In any case, the MOXy guys have been really responsive so far (via StackOverflow), so I'm confident they'd help with any issues we uncover.
To use MOXy as your JAXB implementation
# 1. in pom.xml, uncomment the org.eclipse.persistence.moxy dependency, and the EclipseLink Repo
# 2. run ant JAXB-use-MOXy
To switch back to the Oracle / reference implementation
# 1. run ant JAXB-switch-from-MOXy-to-Oracle
# 2. in pom.xml, comment those things again
If you are successfully using MOXy, your logs should contain:
- Code: Select all
INFO org.docx4j.jaxb.Context .<clinit> line 70 - MOXy JAXB implementation intended..
INFO org.docx4j.jaxb.Context .<clinit> line 102 - loading Context jc
INFO org.docx4j.jaxb.Context .<clinit> line 112 - loaded org.eclipse.persistence.jaxb.JAXBContext .. loading others ..
INFO org.docx4j.jaxb.Context .<clinit> line 115 - MOXy is being used.
Another way to try using MOXy is to download it from http://www.eclipse.org/eclipselink/downloads/ and use http://www.docx4java.org/docx4j/docx4j- ... 121106.jar
I tried it with:
- Code: Select all
| +- org.eclipse.persistence:org.eclipse.persistence.core:jar:2.4.1
| | \- org.eclipse.persistence:org.eclipse.persistence.asm:jar:3.3.1.v201206041142
| \- org.eclipse.persistence:org.eclipse.persistence.antlr:jar:3.2.0.v201206041011
I'm thinking the next release of docx4j will be designated 3.0, to make it easy to know the point at which MOXy support was offered.