0

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);
Reporter
  • 3,897
  • 5
  • 33
  • 47
user1635746
  • 1
  • 1
  • 1

3 Answers3

1

Make sure you have correct version (2.x) of XmlBeans on you classpath.

  • xmlbeans 2.3 is the minimum version to work with Apache POI, anything newer than that ought to work fine too – Gagravarr Aug 30 '12 at 12:28
0

See javadoc :

XmlOptions setSaveAggresiveNamespaces() : 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()

Nandkumar Tekale
  • 16,024
  • 8
  • 58
  • 85
0

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)

fjgarzon
  • 44
  • 4