6

I am trying to write a program which write the data in Excel. But i keep getting an error which is shown below:

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 wriExcel.main(wriExcel.java:19)

On finding the solutions, I could only find that I should use XMLBeans 2.0 or higher. But, I am using xmlbeans 2.3.0. Is there any other reason for this error.

G.S
  • 10,413
  • 7
  • 36
  • 52
prashantk87
  • 81
  • 1
  • 1
  • 7
  • This is a duplicate http://stackoverflow.com/questions/11212652/runtime-error-in-java-with-apache-poi Check you classpath. There might be a conflicting older XMLBeans version somewhere, either bundled with some other library, or provided by whatever framework/appserver you are using. – KarlP Dec 27 '13 at 10:54
  • @prashantk87 if your problem is solved by my answer then you can select my answer – Ashish Dec 27 '13 at 14:02
  • thanks @KarlP, but there are no other conflicting XMLBeans version. – prashantk87 Dec 30 '13 at 05:23
  • 1
    I can only point to the previous question. Download XMLBeans and place it early in the classpath. – KarlP Dec 30 '13 at 16:43
  • 1
    Placing XMLBeans earlier in classpath worked. thanks KarlP – prashantk87 Jan 03 '14 at 06:02

3 Answers3

9

Use xmlbeans-2.6.0.jar which resolves my problem...!

PVR
  • 885
  • 9
  • 18
0

This error might be because required needed for the project is not there so you have to download jar and then add that jar to your classpath here is the link

find out which jar you need

Ashish
  • 1,943
  • 2
  • 14
  • 17
0

Use the xmlbeans jar file shipped with PIO libraries, and avoid to download from any other source as there will be jar file conflicts.

You can find the xmlbeans under "ooxml-lib" shipped with PIO.