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

I am using Apache POI to read some Excel files. I created a console application to complete the task, after which I tried to integrate the code into Spring MVC webApp (nothing special, I know). I included the same Jar files in my Classpath, but whenever I try to run the code, I get this error:

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

I believe that the Font class was found at compile time, but not at runtime. I am sure that the problem is not in ClassPath, but I cannot figure out how to solve this.

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

+4
source share
1 answer

To resolve this issue, follow these steps:

1 - check if your Pom.xml contains any of the Apache POI dependencies.

2 - delete the poi folder from your Maven repository.

3 - run the project as pure maven

4 - update the project

5 - import the ban again into your classpath

6 - run and enjoy

+2
source

Source: https://habr.com/ru/post/1539937/


All Articles