0

I cannot make an XSSF object in java with the apache POI. I have a list of file directories saved as an array of strings as "list[]". xls (HSSF) are working just fine with no errors.

Using the following code:

String s = list[i]; //line 205
InputStream input = new FileInputStream(s);  //line 206 
Workbook wb = new XSSFWorkbook(input); //line 207

I get the 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:56)
    at FileTest.skim(FileTest.java:207)
    at FileTest.main(FileTest.java:125)
vyegorov
  • 21,787
  • 7
  • 59
  • 73
Nick
  • 85
  • 2
  • 5
  • 11

1 Answers1

1

This seems like a library mix-up. I just checked with xmlbeans-2.3.0 and it has the method you're missing. Make sure you have the proper dependencies for the POI version you're using.

Jonas Adler
  • 905
  • 5
  • 9
  • turns out i was just missing xmlbeans jar file. Not sure how i overlooked that, ha. – Nick May 06 '12 at 17:05
  • Update** It also turns out that the newest version of xmlbeans should be applied to the apache poi. the 2.3.0 version works for some things, but i highly recommend downloading the current version for future apache poi programming (2.5.0) – Nick Jun 27 '12 at 16:19