Page 1 of 1

JAXB RI 2.2.3 issues

PostPosted: Wed Apr 13, 2011 11:14 pm
by jason
A heads up that there are several reports of problems using JAXB RI 2.2.3 with docx4j.

If you are encountering this, you should use an earlier implementation of JAXB (via the endorsed dir mechanism, if necessary).

JAXB RI 2.2.3 is used inter alia in Metro 2.1 [1] (and via that, Glassfish 3.1).

I've had a quick look at http://java.net/jira/browse/jaxb but couldn't see any relevant issues. I will investigate further in due course .. anyone else is of course welcome to contribute any findings to this thread.

[1] http://metro.java.net/2.1/

Re: JAXB RI 2.2.3 issues

PostPosted: Fri Apr 15, 2011 2:14 am
by jason
I've found that this problem is related to the presence of the class src/main/java/org/docx4j/wml/Package.java

When I exclude it from the build (and remove references to it from ObjectFactory.java), things work properly.

When it is present, JaxbValidationEventHandler complains that about any element in a namespace other than http://schemas.microsoft.com/office/2006/xmlPackage, and incorrectly reports Expected elements, by claiming they should be in the http://schemas.microsoft.com/office/2006/xmlPackage namespace.

But only for the main document part and the styles part. In my test docx, other parts (eg headers) were unmarshalled ok, even though some of them also used elements in org.docx4j.wml/

So why is Package.java a problem?

Its declaration is:

Code: Select all
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "part"
})
@XmlRootElement(name = "package", namespace = "http://schemas.microsoft.com/office/2006/xmlPackage")
public class Package


To be continued...

Re: JAXB RI 2.2.3 issues

PostPosted: Sat Apr 16, 2011 12:48 pm
by jason

Re: JAXB RI 2.2.3 issues

PostPosted: Mon Apr 18, 2011 11:07 pm
by Franke
Works perfectly now in my project using JAXB RI 2.2.3 (Glassfish v3.1).

Great job!

Re: JAXB RI 2.2.3 issues

PostPosted: Thu Apr 21, 2011 1:22 am
by jason
Great, thanks for the confirmation.