NoClassDefFoundError on org.apache.poi.xssf.usermodel.XSSFWorkbookType in AEM 6.5.16 service pack | Community
Skip to main content
Mario248
Level 7
April 28, 2023
Solved

NoClassDefFoundError on org.apache.poi.xssf.usermodel.XSSFWorkbookType in AEM 6.5.16 service pack

  • April 28, 2023
  • 2 replies
  • 15382 views

I am upgrading the uber jar version to 6.5.15 after upgrading the version I was getting a compilation error before. I followed https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/cannot-access-org-apache-poi-ooxml-poixmldocument-with-latest/m-p/589973#M147300  and resolved the compilation issue. But after fixing the compilation issue I am getting below error message.

 

GetFolderDetails.validateFolderName:321 Unexpected exception thrown: java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.xssf.usermodel.XSSFWorkbookType

This error was not appeared before, it started coming up after uber jar versions change. 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(); ////java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.xssf.usermodel.XSSFWorkbookType

 

 

Dependecies I have included in 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.3</version> </dependency> <dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>5.1.1</version> </dependency>

 

 

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

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sady_Rifat

@mario248 ,

Seems like you correctly include the dependency.

 

<dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>5.1.1</version> </dependency>

 

The object you are trying to initialize is coming from this dependency. Since it's said Classdefination not found, means in OSGI it's not running/installed [Just a wild guess]
If I remembered correctly I got a similar type of error and I solved it to install the JAR using all.pom
Please try with this way,
In all.pom file add this dependency: https://github.com/Sady-Rifat/my-project/blob/53adef48530751372af147a25527921b3dddc5f2/all/pom.xml#L210 

 

<dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <type>jar</type> </dependency>

 

Embed this dependency: https://github.com/Sady-Rifat/my-project/blob/53adef48530751372af147a25527921b3dddc5f2/all/pom.xml#L86 

 

<embedded> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <target>/apps/my-project-vendor-packages/application/install</target> </embedded>

 

 

 

2 replies

Sady_Rifat
Community Advisor
Community Advisor
April 28, 2023

Hello @mario248 ,

Can you please check your dependency is resolved in your bundle?

Mario248
Mario248Author
Level 7
April 28, 2023

I tried to find a depdencies for org.apache.poi.xssf.usermodel.XSSFWorkbook in http://localhost:4502/system/console/depfinder and found 

 

<dependency>
<artifactId>com.adobe.granite.poi</artifactId>
<version>2.0.38-CQ650-B0002</version>
<groupId>com.adobe.granite</groupId>
<scope>provided</scope>
</dependency>

 

Should I use above dependency in my pom.xml

 

 

 

Sady_Rifat
Community Advisor
Sady_RifatCommunity AdvisorAccepted solution
Community Advisor
April 28, 2023

@mario248 ,

Seems like you correctly include the dependency.

 

<dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>5.1.1</version> </dependency>

 

The object you are trying to initialize is coming from this dependency. Since it's said Classdefination not found, means in OSGI it's not running/installed [Just a wild guess]
If I remembered correctly I got a similar type of error and I solved it to install the JAR using all.pom
Please try with this way,
In all.pom file add this dependency: https://github.com/Sady-Rifat/my-project/blob/53adef48530751372af147a25527921b3dddc5f2/all/pom.xml#L210 

 

<dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <type>jar</type> </dependency>

 

Embed this dependency: https://github.com/Sady-Rifat/my-project/blob/53adef48530751372af147a25527921b3dddc5f2/all/pom.xml#L86 

 

<embedded> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <target>/apps/my-project-vendor-packages/application/install</target> </embedded>