Expand my Community achievements bar.

SOLVED

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

Avatar

Level 9

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-p...  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?

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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#L... 

 

<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#L... 

 

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

 

 

 

View solution in original post

3 Replies

Avatar

Community Advisor

Hello @Mario248 ,

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

Avatar

Level 9

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

 

Mario248_0-1682681019772.png

 

 

Avatar

Correct answer by
Community Advisor

@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#L... 

 

<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#L... 

 

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