Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java.lang.NoClassDefFoundError : org/apache/poi/ss/usermodel/Font

I'm Using Apache POI to read some Excel files. I've created a console application to do the job, after that I've tried to integrate the code in a Spring MVC webApp (nothing special, I know). I've included the same Jar files to my Classpath, but whenever I try to run the code, I got this error:

java.lang.NoClassDefFoundError : org/apache/poi/ss/usermodel/Font  

I believe that the class Font was found during compilation time, but not at runtime. I'm pretty sure that the problem is not with the ClassPath, but I can't figure out how to solve this.

EDIT : When I copy the same code in a new class with main method (in the same web project), and run my web app as a console java app, it works.

like image 637
TheByeByeMan Avatar asked Nov 01 '22 00:11

TheByeByeMan


1 Answers

To solve this issue do the following :

1 - check if your Pom.xml doesn't contain any of the Apache POI dependencies.

2 - delete poi folder from your Maven repository.

3 - run your project as a maven clean

4 - update project

5 - Import again you poi Jars to your classpath

6 - run and enjoy

like image 146
Guen_hamza Avatar answered Nov 15 '22 03:11

Guen_hamza