I want to use docx4j to convert html files to docx files. I create a project in Eclipse and the conversion is ok, but when I try to integrate docx4j in our web application I have an error. I use: - Docx4J v3.2.1 - Java v1.6 - Resin 2.1.0. I added all the dependencies jars in Build Path’s project.
The error is :
2014-11-10 10:33:10 ERROR: Cannot initialize context com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 61 counts of IllegalAnnotationExceptions Two classes have the same XML type name "CT_TwipsMeasure". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at org.docx4j.wml.CTTwipsMeasure at protected org.docx4j.wml.CTTwipsMeasure org.docx4j.wml.CTFramesetSplitbar.w …….. 2014-11-10 10:33:17 ERROR: javax.xml.bind.JAXBException - with linked exception: [java.lang.NullPointerException] at org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware.unmarshal(JaxbXmlPartXPathAware.java:439) at org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart.unmarshalDefaultStyles(StyleDefinitionsPart.java:147) at org.docx4j.openpackaging.packages.WordprocessingMLPackage.createPackage(WordprocessingMLPackage.java:416) at org.docx4j.openpackaging.packages.WordprocessingMLPackage.createPackage(WordprocessingMLPackage.java:377)
Thank you.
Have a look at what JAXB implementation Resin is using. Is it using an implementation included in Java, or some other?
If you can use the reference implementation (a recent version), do that. Otherwise, you can add MOXy to your class path. See further http://www.docx4java.org/forums/docx-java-f6/moxy-t1242.html