Apache poi无法打开word文档:NoSuchMethodError使用ooxml-shemas-1.0.jar但不能使用poi-ooxmlshemas-3.8.jar

时间:2012-10-29 09:26:53

标签: java apache-poi openxml

我正在使用Apache poi来操作word 2007文档。我正在使用ooxml-shemas-1.0,但有以下消息:

Caused by: java.lang.NoSuchMethodError: org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes.getFootnoteList()Ljava/util/List;
        at org.apache.poi.xwpf.usermodel.XWPFFootnotes.onDocumentRead(XWPFFootnotes.java:84)
        at org.apache.poi.xwpf.usermodel.XWPFDocument.initFootnotes(XWPFDocument.java:235)
        at org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:137)
        at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:159)
        at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:123)
        at com.scientiweb.utils.WordDocumentProcessor.loadFromTemplate(WordDocumentProcessor.java:74)

我在poi-ooxmlshemas-3.8.jar中找到了我不再使用的方法,因为我用ooxml-shemas-1.0.jar(14 mb)替换它。在这种情况下我该怎么做?

2 个答案:

答案 0 :(得分:3)

发现它!我不得不使用ooxml-schemas-1.1.jar 答案在这里:http://poi.apache.org/faq.html#faq-N10025

答案 1 :(得分:0)

Since POI 3.7 the ooxml-schemas-1.1.jar is needed you can download it from here http://repo1.maven.org/maven2/org/apache/poi/ooxml-schemas/1.1/ooxml-schemas-1.1-sources.jar