Comment #4 on issue 159 by
wilkinso...@gmail.com: Can not find DOCX
Hi,
The good news is that I’ve got the xdocreport working creating a pdf with
itext.
The bad news is that I had to modify your docx.xwpf-0.9.8 bundle to get it
working.
To get it working I took your list of jars from the zip file
(docxandvelocity.converters-0.9.8-sample.zip) excluding the velocity and
adding freemaker. [thanks for providing that by the way]
I used the following bundles in the OSGi container (in brackets if not
already an osgi bundle)
commons-codec-1.5.jar (com.springsource.org.apache.commons.codec-1.4.0.jar)
commons-collections-3.2.1.jar
(com.springsource.org.apache.commons.collections-3.2.1.jar)
commons-lang-2.4.jar (com.springsource.org.apache.commons.lang-2.6.0.jar)
dom4j-1.6.1.jar (com.springsource.org.dom4j-1.6.1.jar)
fr.opensagres.xdocreport.converter-0.9.8.jar
fr.opensagres.xdocreport.converter.docx.xwpf-0.9.8.jar
(modified-fr.opensagres.xdocreport.converter.docx.xwpf-0.9.8- modified
MANIFEST.MF to import-package fr.opensagres.xdocreport.core.utils)
fr.opensagres.xdocreport.core-0.9.8.jar
fr.opensagres.xdocreport.document-0.9.8.jar
fr.opensagres.xdocreport.document.docx-0.9.8.jar
fr.opensagres.xdocreport.itext.extension-0.9.8.jar
fr.opensagres.xdocreport.template-0.9.8.jar
fr.opensagres.xdocreport.template.freemarker-0.9.8.jar
itext-2.1.7.jar (wrapper-itext-2.1.7.jar - created custom shade wrapper)
ooxml-schemas-1.1.jar (poi-osgi-wrapper-3.8.jar - created custom shade
wrapper)
org.apache.poi.xwpf.converter-0.9.8.jar
oro-2.0.8.jar (com.springsource.org.apache.oro-2.0.8.jar)
poi-3.8.jar (poi-osgi-wrapper-3.8.jar - created custom shade wrapper)
poi-ooxml-3.8.jar (poi-osgi-wrapper-3.8.jar - created custom shade wrapper)
stax-api-1.0.1.jar (com.springsource.javax.xml.stream-1.0.1.jar)
xml-apis-1.0.b2.jar (com.springsource.org.apache.xmlcommons-1.3.4.jar)
xmlbeans-2.3.0.jar (modified-com.springsource.org.apache.xmlbeans-2.4.0.jar
modified MANIFEST.MF to import-package org.w3c.dom)
Note that I had to modify
fr.opensagres.xdocreport.converter.docx.xwpf-0.9.8.jar to add an
import-package for fr.opensagres.xdocreport.core.utils, in
fr.opensagres.xdocreport.converter.docx.xwpf as it needed StringUtils.
Caused by: java.lang.NoClassDefFoundError:
fr/opensagres/xdocreport/core/utils/StringUtils
at
fr.opensagres.xdocreport.converter.docx.poi.itext.XWPF2PDFViaITextConverter.toPDFViaITextOptions(XWPF2PDFViaITextConverter.java:93)
at
fr.opensagres.xdocreport.converter.docx.poi.itext.XWPF2PDFViaITextConverter.convert(XWPF2PDFViaITextConverter.java:66)
at
fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:685)
... 34 more
Caused by: java.lang.ClassNotFoundException:
fr.opensagres.xdocreport.core.utils.StringUtils
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:814)
If you could comment on if you think this is valid and whether you could
modify this yourselves and when then that would be great, else I’ll just
have to create a patched version and deploy to our maven repository.
I also had to modify com.springsource.org.apache.xmlbeans-2.4.0.jar
modified MANIFEST.MF to import-package org.w3c.dom to prevent..
Caused by: java.lang.NoClassDefFoundError
at org.apache.xmlbeans.XmlBeans.class$(XmlBeans.java:43)
at org.apache.xmlbeans.XmlBeans.buildNodeMethod(XmlBeans.java:195)
at org.apache.xmlbeans.XmlBeans.buildNodeToCursorMethod(XmlBeans.java:232)
at org.apache.xmlbeans.XmlBeans.<clinit>(XmlBeans.java:131)
at
org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument$Factory.parse(Unknown
Source)
at
org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:134)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:159)
at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:123)
at
fr.opensagres.xdocreport.converter.docx.poi.itext.XWPF2PDFViaITextConverter.convert(XWPF2PDFViaITextConverter.java:65)
at
fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:685)
... 34 more
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.Node
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:814)
As this is just a wrapper, I will create my own wrapper, re-wrapping the
original xmlbeans library with the required org.w3c.dom import.
I had to wrap all the apache.poi libraries as I couldn't locate osgi
bundles for these. (poi-3.8.jar, poi-ooxml-3.8.jar and
ooxml-schemas-1.1.jar all wrapped in my wrapper ooxml-schemas-1.1.jar).
(attached poi.pom.xml).
I had to wrap the itext libraries to get the 2.1.7 version of itext, as I
could only locate a springsource version at 2.0.8.
(attached itext.pom.xml)
I had to ensure that org.w3c.dom was being exported from the java runtime
via the felix container by adding org.w3c.dom to the
org.osgi.framework.system.packages property in felix.properties.
Finally I had to increase the permgen heap size from its default (64m) to
128m by adding -XX:MaxPermSize=128m to the batch file we use to lanch the
osgi container, to prevent..
fr.opensagres.xdocreport.converter.XDocConverterException:
java.lang.OutOfMemoryError: PermGen space
at
fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:720)
at
com.experian.eda.component.workflow.runtime.engine.handler.DocumentTemplateActivityBehaviour.mergeDoc(DocumentTemplateActivityBehaviour.java:286)
at
com.experian.eda.component.workflow.runtime.engine.handler.DocumentTemplateActivityBehaviour.executeInternal(DocumentTemplateActivityBehaviour.java:187)
at
com.experian.eda.component.workflow.runtime.engine.handler.AbstractActivityBehaviour.execute(AbstractActivityBehaviour.java:57)
Regards,
Philip Wilkinson.
Attachments:
itext-pom.xml 3.4 KB
poi-pom.xml 3.8 KB