ClassNotFoundException: org.slf4j.Logger

Ion*_*nut 3 java ant logging tomcat slf4j

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
Run Code Online (Sandbox Code Playgroud)

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}"/>
Run Code Online (Sandbox Code Playgroud)

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!

MTi*_*ted 6

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

and then restart tomcat.