Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClassNotFoundException: org.slf4j.Logger

I'm trying to deploy a web app to tomcat using ANT but I ran into this error (the app compiles fine in a simple ant task. The issue occurs when Tomcat is restarted):

Stacktrace:

Caused by: java.lang.ClassNotFoundException: org.slf4j.Logger
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    ... 24 more

I red a couple of answers around here which state that besides slf4j an implementation such as log4j. This is an excerpt of the build.xml file:

<pathelement location="${slf4j-api-1.7.2.jar}"/>
<pathelement location="${log4j.jar}"/>

These are path elements used in the classpath of the build's javac command.

Besides not adding log4j as a dependency, what may be other reasons for this issue. Any kind of help would be appreciated. Thanks!

like image 966
Ionut Avatar asked Dec 13 '25 13:12

Ionut


1 Answers

You need to add the .jar files your app need to $TOMCAT/webapps/$YOUR_WEB_APP/WEB-INF/lib/

and then restart tomcat.

like image 79
MTilsted Avatar answered Dec 16 '25 02:12

MTilsted



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!