Expand my Community achievements bar.

cannot access org.apache.poi.ooxml.POIXMLDocument with latest uber version 6.5.15

Avatar

Level 9

I am facing compilation error after upgrading uber jar version from 6.5.0 to 6.5.15.

 

Updated Uber jar

<dependency>
     <groupId>com.adobe.aem</groupId>
     <artifactId>uber-jar</artifactId>
     <version>6.5.15</version>
     <scope>provided</scope>
</dependency>

 

After updated uber I tried to compile the code but ended up with below error, 

 

[ERROR] COMPILATION ERROR :

[INFO] -------------------------------------------------------------

[ERROR] ImageRender.java:[326,42] cannot access org.apache.poi.ooxml.POIXMLDocument

  class file for org.apache.poi.ooxml.POIXMLDocument not found

 

I thought the latest version removed this org.apache.poi.ooxml.POIXMLDocument so I manually added below dependency to resolve the issue 

 

 

 

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

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

 

 
But even after above dependency I get the same compile time error. Is there any problem with org.apache.poi.ooxml.POIXMLDocument in latest uber version (6.5.15)
 
Is anyone facing this similar issue ?
6 Replies

Avatar

Community Advisor

Hello @Mario248 ,

Try with the same version of both dependency

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>    
    <groupId>org.apache.poi</groupId>    
    <artifactId>poi-ooxml</artifactId>    
    <version>5.2.2</version>
</dependency>

A similar thing is discussed here.

https://stackoverflow.com/questions/63384557/issue-with-apache-poi-upgrading-aem-from-6-5-2-6-5-5

 

Avatar

Level 1

Use below code instead of Workbook workbook = new XSSFWorkbook() it will resolve your issue.

 

Workbook workbook = new HSSFWorkbook();

 

Avatar

Level 9

Sorry, I forgot to mention I have included both artifactId poi & poi-ooxml but still I am getting the same error. I have included below dependencies in parent pom.xml 

 

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

 Added below dependencies in core module's pom.xml 

 

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

 

Avatar

Level 9

Thank you so much for your input. It resolved compilation issue but I am facing issue in junit - Unexpected exception thrown: java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.xssf.usermodel.XSSFWorkbookType

 

When I checked the java class I found that XSSFWorkbook is having problem. I see below code

 

Workbook workbook = new org.apache.poi.xssf.usermodel.XSSFWorkbook();

 

Any idea why idea why junit class is unable to initialize class org.apache.poi.xssf.usermodel.XSSFWorkbookType?