I updated my docx4j project from 3.3.5 to 6.0.1 and I have a wierd problem.
- Code: Select all
Docx4J.load(new File(filePath));
The code above throws this exception:
- 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:523)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:379)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:345)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:310)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:184)
at org.docx4j.Docx4J.load(Docx4J.java:272)
at neti.component.processor.DocxProcessor.createWordMLPackage(DocxProcessor.java:229)
... 4 more
Caused by: org.docx4j.openpackaging.exceptions.InvalidFormatException: Bad [Content_Types].xml
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:771)
at org.docx4j.openpackaging.io3.Load3.get(Load3.java:146)
... 11 more
Caused by: java.lang.NullPointerException
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:737)
... 12 more
In debug mode I found the source maybe. It says
Context.jcContentTypes = Class not loaded : org.docx4j.jaxb.Context
Because of that unloaded class an inner exception generated with this message:
Method threw 'java.lang.RuntimeException' exception. Cannot evaluate org.docx4j.openpackaging.contenttype.ContentTypeManager.toString()
This exception coming from ContentTypeManager.java at line 737.
I hope you can help.
Best regards:
Adam