user1635746
user1635746

Reputation: 1

"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);

Upvotes: 0

Views: 5330

Answers (3)

fjgarzon
fjgarzon

Reputation: 44

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)

Upvotes: 0

Nandkumar Tekale
Nandkumar Tekale

Reputation: 16158

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()

Upvotes: 0

Sergey Nikitin
Sergey Nikitin

Reputation: 116

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

Upvotes: 1

Related Questions