I'm trying to open a file whith extension .docx.
i'm doing like this:
- Code: Select all
public class DocxTest {
public static void main(String[] args) {
WordprocessingMLPackage wordMLPackage;
try {
wordMLPackage = WordprocessingMLPackage.load(new java.io.File("C:\\modelo.docx"));
} catch (Docx4JException e) {
e.printStackTrace();
}
}
}
but i'm receiving that error:
JJAXB: RI not present. Trying Java 6 implementation.
JAXB: Using Java 6 implementation.
log4j:WARN No appenders could be found for logger (org.docx4j.openpackaging.contenttype.ContentTypeManager).
log4j:WARN Please initialize the log4j system properly.
java.lang.NullPointerException
at org.docx4j.openpackaging.io.LoadFromZipNG.getInputStreamFromZippedPart(LoadFromZipNG.java:294)
at org.docx4j.openpackaging.io.LoadFromZipNG.getRawPart(LoadFromZipNG.java:489)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:404)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:334)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:426)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:334)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:226)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:179)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:188)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:163)
at br.com.docx.DocxTest.main(DocxTest.java:11)
org.docx4j.openpackaging.exceptions.Docx4JException: Failed to add parts from relationships
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:336)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:226)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:179)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:188)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:163)
at br.com.docx.DocxTest.main(DocxTest.java:11)
Caused by: org.docx4j.openpackaging.exceptions.Docx4JException: Failed to add parts from relationships
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:336)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:426)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:334)
... 5 more
Caused by: org.docx4j.openpackaging.exceptions.Docx4JException: Failed to getPart
at org.docx4j.openpackaging.io.LoadFromZipNG.getRawPart(LoadFromZipNG.java:558)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:404)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:334)
... 7 more
Caused by: java.lang.NullPointerException
at org.docx4j.openpackaging.io.LoadFromZipNG.getInputStreamFromZippedPart(LoadFromZipNG.java:294)
at org.docx4j.openpackaging.io.LoadFromZipNG.getRawPart(LoadFromZipNG.java:489)
... 9 more
Process exited with exit code 0.
i've added the libraries:
core-renderer-R8pre2
docx4j-2.3.0
fop-patched-0.95.756437
hwpf-3.4.0
itext-unsigned-2.0.8
jcr-1.0
jdom-1.0
junit-4.4
log4j-1.2.15
minium-0.1
parent-pointer-plugin-1.0
pdf-renderer-0.2009.0324
xalan-patched-2.7.0
xmlgraphics-commons-1.3.757686
Whoud be that does anybody know what can be?
Thanks...