1

I am using the Poi(poi, poi-ooxml-schemas,poi-ooxml-4.4.1 ) api for export-import operation, and now upgraded xmlbeans from 3.0.2 to 5.0.1 version, after upgrading the xmlbeans-5.0.1 getting error while creating new SXSSFWorkbook(100);

.... java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.put(Ljava/lang/Object;)V java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.xssf.model.SharedStringsTable

and using jaxb-api-2.4.0-b180830.0359 version.

Rambabu Pudi
  • 33
  • 1
  • 12
  • have you tried POI 5.0.0? ... you only need to add the dependency to poi-ooxml:5.0.0, which depends on / fetches XmlBeans and other libraries. remove all other / old dependencies which were related to POI – kiwiwings Aug 24 '21 at 22:35
  • thank you @kiwiwings, Yeah after upgrading POI(from 4.4.1 to 5.0.0) it started working but is xmlbeans 5.0.1 is not compatible with the POI-4.4.1 version? – Rambabu Pudi Aug 27 '21 at 13:39
  • short answer: no - I've changed so many parts under the hood in XmlBeans to support JPMS, so please use the version which is referenced by POI. Starting with POI 5, we also provide the schemas with every POI release to minimize confusion which schema jar to be used. – kiwiwings Aug 27 '21 at 18:04

4 Answers4

0

I found the following dependency in my pom.xml code and once i removed it.It worked fine for me.

<dependency>
    <groupId>org.apache.servicemix.bundles</groupId>
    <artifactId>org.apache.servicemix.bundles.poi</artifactId>
    <version>4.1.2_1</version>
</dependency>

So remove it and it will work.

0

I had updated to XMLBeans 5.0.3 earlier. So to fix this I had to update to latest POI (I had the 4.x.x series of POI earlier):

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>5.2.2</version>
</dependency>
0

I solved this problem by simply removing all packages of xmlbeans in my repository and reloading maven projects.

In most cases, if a java.lang.NoSuchMethodError error occurs, the cause could be a dependency package conflict.

Anye
  • 1
  • 3
0
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>4.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>4.1.2</version>
</dependency>
You can try this also or can move to higher/lower dependency