I've created a simple demo application for variable replacement inside of docx documents using docx4j and everything worked just fine (java 8, running locally, created in IntelliJ idea).
Unfortunately, I need this app to run on Wildfly 11 server and Liferay, and so far haven't succeeded.
- Code: Select all
Caused by: org.docx4j.openpackaging.exceptions.Docx4JException: Couldn't get [Content_Types].xml from ZipFile
at org.docx4j.openpackaging.io3.Load3.get(Load3.java:148)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:561)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:410)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:376)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:341)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:180)
at cz.sonet.service.DocxService.getTemplate(DocxService.java:47)
at cz.sonet.portlet.LiferayDocxController.generateDocx(LiferayDocxController.java:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:180)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:367)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.doHandle(AnnotationMethodHandlerAdapter.java:354)
at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.handleResource(AnnotationMethodHandlerAdapter.java:300)
at org.springframework.web.portlet.DispatcherPortlet.doResourceService(DispatcherPortlet.java:855)
at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:540)
... 201 more
Caused by: org.docx4j.openpackaging.exceptions.InvalidFormatException: Bad [Content_Types].xml
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:871)
at org.docx4j.openpackaging.io3.Load3.get(Load3.java:146)
... 218 more
Caused by: java.lang.NullPointerException
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:838)
... 219 more
I am using maven dependency:
- Code: Select all
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-ReferenceImpl</artifactId>
<version>8.2.9</version>
</dependency>
I have tried to add jboss-deployment-structure.xml with
- Code: Select all
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="com.sun.xml.bind" />
</dependencies>
</deployment>
</jboss-deployment-structure>
but exception is still the same.
Docx document is very simple and as I've mentioned, worked okay locally.
I will thankful for any help.