简体   繁体   中英

“java.lang.NoSuchMethodError” exception in reading xmlbeans

I am trying to read XLSX file.its showing this error

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces()Lorg/apache/xmlbeans/XmlOptions;
        at org.apache.poi.POIXMLDocumentPart.<clinit>(POIXMLDocumentPart.java:46)
        at NewClass.main(NewClass.java:33)
Java Result: 1

error is in line:

OPCPackage opc=OPCPackage.open(is);
XSSFWorkbook wb= new XSSFWorkbook(opc);

确保您的类路径上具有正确的XmlBeans版本(2.x)。

See javadoc :

XmlOptions setSaveAggresiveNamespaces() : Deprecated. replaced by setSaveAggressiveNamespaces() in 2.0 Deprecated. replaced by setSaveAggressiveNamespaces() in 2.0 . You might be using Apache XMLBeans 1.x library. Either use latest release(recommended) or change method call to setSaveAggresiveNamespaces()

Check that your version of xmlbeans is correct. If you are using maven, finds that there is no other unit that contains a different version of xmlbeans. (Use mvn dependency: tree)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM