Log4j and Tomcat issue

(Recovered from my old Blog).

Quick one – I had this issue today so wanted to record it for posterity.

Tomcat can get confused if WEB-INF/lib contains the log4j jar, with initialisation errors such as:

java.lang.ClassNotFoundException: org.apache.log4j.Category

You might not even have directly included it – it might be included via a Maven dependency.

The solution is simple; remove log4j! It’s (often) already included in Tomcat, which is the root cause of the issues. If it’s a Maven dependency, add an exclusion.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: