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)

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

turns out i was just missing xmlbeans jar file. Not sure how i overlooked that, ha.
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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.