After many days searching from a similar problem and its solution on the internet, I now please request your help.
First of all I'm working with :
Java 8 (openjdk), Maven 3, Tomcat 8.5 and I use Eclipse-2019-09 as my IDE.
For this project I'm build a war with maven, adding the ressource to a tomcat server and start it.
Now the problem is whenever I try to launch my tomcat server I get this error :
Caused by: java.lang.ClassNotFoundException: org.codehaus.stax2.ri.Stax2EventFactoryImpl
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Edit : to be more precise, this error append when a bean is getting created. The bean name is "sessionFactory" and its class is : org.springframework.orm.hibernate5.LocalSessionFactoryBean
I firstly thought that Eclipse wasn't resolving the stax2 dependency but when I looked in the classpath the dependency was there. (As you can see on the picture bellow)
dependency in Eclipse pom.xml view
So I thought maybe the jar may not contain the required class but still, when opening the jar in the navigator the class is there.
The last thing I had to check was to see if the jar file was contained in the war file that is built after compiling the project and still, the class is there.
So, What have I tried :
Maven>Update Projects, Clean/Rebuild project, Maven clean/install and compile the project, clean the tomcat work directory, republish etc.
Unistall/Reinstall Eclipse, deleting every hidden folders.
Delete the project, clone it to a fresh new workspace.
Changed the version of stax2 in my pom.xml
Checked if the jar missing is in the deployed war
Deleted my .m2/repository
Loaded the stax2-api as the first dependency in my pom.xml
The strange thing is that whenever I clone the project on a co worker computer, he can compile/start the server without any exceptions.
I'm a bit lost I must admit, spent a lot a time searching on forums an answer but everything I tried resultd as a failure.
Well, thank you for reading me, if someone has any idea, let me know.